Spec-Zone .ru
спецификации, руководства, описания, API
|
CONTENTS | PREV | NEXT | Java Object Serialization Specification |
TheObjectStreamClass
provides information about classes that are saved in a Serialization stream. The descriptor provides the fully-qualified name of the class and its serialization version UID. ASerialVersionUID
identifies the unique original class version for which this class is capable of writing streams and from which it can read.package java.io; public class ObjectStreamClass { public static ObjectStreamClass lookup(Class cl); public String getName(); public Class forClass(); public ObjectStreamField[] getFields(); public long getSerialVersionUID(); public String toString(); }Thelookup
method returns theObjectStreamClass
descriptor for the specified class in the virtual machine. If the class has definedserialVersionUID
it is retrieved from the class. If theserialVersionUID
is not defined by the class, it is computed from the definition of the class in the virtual machine. If the specified class is not serializable or externalizable, null is returned.The
getName
method returns the fully-qualified name of the class. The class name is saved in the stream and is used when the class must be loaded.The
forClass
method returns theClass
in the local virtual machine if one was found byObjectInputStream.resolveClass
method. Otherwise, it returns null.The
getFields
method returns an array ofObjectStreamField
objects that represent the serializable fields of this class.The
getSerialVersionUID
method returns theserialVersionUID
of this class. Refer to Section 4.6, "Stream Unique Identifiers." If not specified by the class, the value returned is a hash computed from the class's name, interfaces, methods, and fields using the Secure Hash Algorithm (SHA) as defined by the National Institute of Standards.The
toString
method returns a printable representation of the class descriptor including the name of the class and theserialVersionUID
.