java.io

Class ObjectStreamClass

public class ObjectStreamClass extends Object implements Serializable

Field Summary
static ObjectStreamField[]NO_FIELDS
Method Summary
Class<?>forClass()
Returns the class that this ObjectStreamClass represents.
ObjectStreamFieldgetField(String name)
ObjectStreamField[]getFields()
Returns the serializable (non-static and non-transient) Fields of the class represented by this ObjectStreamClass.
StringgetName()
Returns the name of the class that this ObjectStreamClass represents.
longgetSerialVersionUID()
Returns the serial version stream-unique identifier for the class represented by this ObjectStreamClass.
static ObjectStreamClasslookup(Class<?> cl)
Returns the ObjectStreamClass for cl.
StringtoString()
Returns a textual representation of this ObjectStreamClass object including the name of the class it represents as well as that class's serial version stream-unique identifier.

Field Detail

NO_FIELDS

public static final ObjectStreamField[] NO_FIELDS

Method Detail

forClass

public Class<?> forClass()
Returns the class that this ObjectStreamClass represents. Null could be returned if this ObjectStreamClass was read from an ObjectInputStream and the class it represents cannot be found or loaded.

See Also: ObjectInputStream

getField

public ObjectStreamField getField(String name)

getFields

public ObjectStreamField[] getFields()
Returns the serializable (non-static and non-transient) Fields of the class represented by this ObjectStreamClass. The Fields are sorted by name. If fields were obtained using serialPersistentFields and this array is faulty then the returned array of this method will be empty.

Returns: the fields.

getName

public String getName()
Returns the name of the class that this ObjectStreamClass represents.

Returns: the name of the class.

getSerialVersionUID

public long getSerialVersionUID()
Returns the serial version stream-unique identifier for the class represented by this ObjectStreamClass. This SUID is either defined by the class as static final long serialVersionUID or is calculated as specified in Javasoft's "Object Serialization Specification" XXX: add reference

Returns: the serial version UID.

lookup

public static ObjectStreamClass lookup(Class<?> cl)
Returns the ObjectStreamClass for cl. If cl is null, or is not Serializable, null is returned. ObjectStreamClass's are memorized; later calls to this method with the same class will return the same ObjectStreamClass object and no recalculation will be done. Warning: If this class contains an invalid serialPersistentField arrays lookup will not throw anything. However {@link #getFields()} will return an empty array and {@link java.io.ObjectOutputStream#writeObject} will throw an {@link java.io.InvalidClassException}.

See Also: Serializable

toString

public String toString()
Returns a textual representation of this ObjectStreamClass object including the name of the class it represents as well as that class's serial version stream-unique identifier.

See Also: getSerialVersionUID getName