This documentation differs from the official API.
Jadeite adds
extra features to the API including:
variable font sizes,
constructions examples,
placeholders for classes and methods, and auto-generated “See Also” links.
Additionally it
is missing some items found in standard Javadoc documentation, including:
generics type information,
“Deprecated” tags and comments,
“See Also” links,
along with other minor differences.
Please send any questions or feedback to
bam@cs.cmu.edu.
java.io
class ObjectStreamClass
- All Implemented Interfaces:
- Serializable
-
Most common way to construct:
-
Class currclass = …;
ObjectStreamClass osc = ObjectStreamClass.lookup(currclass);
Based on 6 examples
public class ObjectStreamClass
extends Object
implements Serializable
Serialization's descriptor for classes. It contains the name and
serialVersionUID of the class. The ObjectStreamClass for a specific class
loaded in this Java VM can be found/created using the lookup method.
The algorithm to compute the SerialVersionUID is described in
Object
Serialization Specification, Section 4.6, Stream Unique Identifiers.
- See Also (auto-generated):
-
ObjectInputStream
Method
ObjectOutputStream
Method Summary |
Class |
Return the class in the local VM that this version is mapped to.
|
ObjectStreamField |
Get the field of this class by name.
|
ObjectStreamField[] |
Return an array of the fields of this serializable class.
|
String |
Returns the name of the class described by this descriptor.
|
long |
Return the serialVersionUID for this class.
|
static ObjectStreamClass |
Find the descriptor for a class that can be serialized.
|
static ObjectStreamClass |
Returns the descriptor for any class, regardless of whether it
implements java.io.Serializable.
|
String |
Return a string describing this ObjectStreamClass.
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NO_FIELDS
public static final ObjectStreamField[] NO_FIELDS
-
serialPersistentFields value indicating no serializable fields
forClass
public Class forClass()
-
Return the class in the local VM that this version is mapped to. Null
is returned if there is no corresponding local class.
- Returns:
- the
Class
instance that this descriptor represents
getField
public ObjectStreamField getField(String name)
-
Get the field of this class by name.
- Parameters:
name
- the name of the data field to look for
- Returns:
- The ObjectStreamField object of the named field or null if
there is no such named field.
getFields
public ObjectStreamField[] getFields()
-
Return an array of the fields of this serializable class.
- Returns:
- an array containing an element for each persistent field of
this class. Returns an array of length zero if there are no
fields.
getName
public String getName()
-
Returns the name of the class described by this descriptor.
This method returns the name of the class in the format that
is used by the {@link Class#getName} method.
- Returns:
- a string representing the name of the class
getSerialVersionUID
public long getSerialVersionUID()
-
Return the serialVersionUID for this class. The serialVersionUID
defines a set of classes all with the same name that have evolved from a
common root class and agree to be serialized and deserialized using a
common format. NonSerializable classes have a serialVersionUID of 0L.
- Returns:
- the SUID of the class described by this descriptor
lookup
public static ObjectStreamClass lookup(Class cl)
-
Find the descriptor for a class that can be serialized. Creates an
ObjectStreamClass instance if one does not exist yet for class. Null is
returned if the specified class does not implement java.io.Serializable
or java.io.Externalizable.
- Parameters:
cl
- class for which to get the descriptor
- Returns:
- the class descriptor for the specified class
lookupAny
public static ObjectStreamClass lookupAny(Class cl)
-
Returns the descriptor for any class, regardless of whether it
implements {@link Serializable}.
- Parameters:
cl
- class for which to get the descriptor
- Returns:
- the class descriptor for the specified class
toString
public String toString()
-
Return a string describing this ObjectStreamClass.
- Overrides:
toString
in class Object
This documentation differs from the official API.
Jadeite adds
extra features to the API including:
variable font sizes,
constructions examples,
placeholders for classes and methods, and auto-generated “See Also” links.
Additionally it
is missing some items found in standard Javadoc documentation, including:
generics type information,
“Deprecated” tags and comments,
“See Also” links,
along with other minor differences.
Please send any questions or feedback to
bam@cs.cmu.edu.
This page displays the
Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
The official Sun™ documentation can be found here at
http://java.sun.com/javase/6/docs/api/.