jsdsi
Class Obj

java.lang.Object
  extended byjsdsi.Obj
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
Acl, AclEntry, Cert, Hash, Name, ObjectHash, OnlineTest, Op, Principal, Proof, Sequence, Signature, Tag, Threshold, Validity

public abstract class Obj
extends java.lang.Object
implements java.io.Serializable

Common superclass of all SPKI/SDSI objects.

Note: As serialization is performed by writing the object to the the stream as a canonical Sexpression, all subclasses of jsdsi.Obj should declare their fields as transient.

Version:
$Revision: 1.10.2.1 $ $Date: 2005/11/08 03:12:52 $
Author:
Sameer Ajmani, Sean Radford
See Also:
Serialized Form

Field Summary
protected  Obj _obj
          The replacement SPKI/SDSI object read from the java.io.ObjectInputStream during #readObject(java.io.ObjectInputStream) and to be returned via readResolve().
 
Constructor Summary
Obj()
           
 
Method Summary
abstract  boolean equals(java.lang.Object o)
           
abstract  int hashCode()
           
static Obj parseObj(Sexp s)
          Parses an S-expression an returns a SDSI object.
static Obj parseObj(SexpList l)
          Parses an SexpList an returns a SDSI object.
protected  java.lang.Object readResolve()
           
 byte[] toByteArray()
           
abstract  SexpList toSexp()
          Creates an SexpList -representation from this SDSI-object.
 java.lang.String toString()
          Returns the S-expression representation of this SPKI/SDSI object in readable form, using the standard S-expression charactrer encoding (8859-1).
 java.lang.String toString(int offset, int width, int last)
          Returns the S-expression representation of this SPKI/SDSI object in readable form, using the standard S-expression charactrer encoding (8859-1).
 byte[] toTransport()
          Returns the S-expression representation of this SPKI/SDSI object in transport form.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

_obj

protected transient Obj _obj
The replacement SPKI/SDSI object read from the java.io.ObjectInputStream during #readObject(java.io.ObjectInputStream) and to be returned via readResolve().

Constructor Detail

Obj

public Obj()
Method Detail

equals

public abstract boolean equals(java.lang.Object o)
See Also:
Object.equals(java.lang.Object)

hashCode

public abstract int hashCode()
See Also:
Object.hashCode()

toSexp

public abstract SexpList toSexp()
Creates an SexpList -representation from this SDSI-object.

Returns:
an SexpList that represents this SDSI-object.

toString

public java.lang.String toString()
Returns the S-expression representation of this SPKI/SDSI object in readable form, using the standard S-expression charactrer encoding (8859-1).

See Also:
Object.toString()

toString

public java.lang.String toString(int offset,
                                 int width,
                                 int last)
Returns the S-expression representation of this SPKI/SDSI object in readable form, using the standard S-expression charactrer encoding (8859-1).

Parameters:
offset - spaces indented from left.
width - total width of window, in characters.
last - spaces reserved on right (e.g., for closing parens)
Returns:
the S-expression

toTransport

public byte[] toTransport()
Returns the S-expression representation of this SPKI/SDSI object in transport form. If the transport form is required as a java.lang.String, then simply pass the resulting byte[] from this method into Sexp.decodeString(byte[]) (This process is required as S-expression's must use the 8859-1 character encoding).

Returns:
the S-expression

toByteArray

public byte[] toByteArray()
Returns:
an array of bytes with the canonical representation of this SDSI/SPKI object.

readResolve

protected java.lang.Object readResolve()
                                throws java.io.ObjectStreamException
Returns:
the SPKI/SDSI object which is the replacement after serialization.
Throws:
java.io.ObjectStreamException
See Also:
Serializable

parseObj

public static Obj parseObj(Sexp s)
                    throws SexpParseException
Parses an S-expression an returns a SDSI object.

Parameters:
s - the S-expression to parse.
Returns:
a SDSI object stored in s.
Throws:
SexpParseException

parseObj

public static Obj parseObj(SexpList l)
                    throws SexpParseException
Parses an SexpList an returns a SDSI object.

Parameters:
l - the SexpList that stores the SDSI object.
Returns:
a SDSI object stored in l.
Throws:
SexpParseException


Copyright © 2002-2006 JSDSI. All Rights Reserved.