Skip to content

Most visited

Recently visited

navigation
Added in API level 1

ObjectStreamClass

public class ObjectStreamClass
extends Object implements Serializable

java.lang.Object
   ↳ java.io.ObjectStreamClass


Represents a descriptor for identifying a class during serialization and deserialization. Information contained in the descriptor includes the name and SUID of the class as well as field names and types. Information inherited from the superclasses is also taken into account.

See also:

Summary

Fields

public static final ObjectStreamField[] NO_FIELDS

Constant indicating that the class has no Serializable fields.

Public methods

Class<?> forClass()

Returns the class (java.lang.Class) for this descriptor.

ObjectStreamField getField(String name)

Gets a field descriptor of the class represented by this class descriptor.

ObjectStreamField[] getFields()

Returns a collection of field descriptors for the serialized fields of the class represented by this class descriptor.

String getName()

Returns the name of the class represented by this descriptor.

long getSerialVersionUID()

Returns the Serial Version User ID of the class represented by this descriptor.

static ObjectStreamClass lookup(Class<?> cl)

Returns the descriptor for a serializable class.

static ObjectStreamClass lookupAny(Class<?> cl)

Returns the descriptor for any class, whether or not the class implements Serializable or Externalizable.

String toString()

Returns a string containing a concise, human-readable description of this descriptor.

Inherited methods

From class java.lang.Object

Fields

NO_FIELDS

Added in API level 1
ObjectStreamField[] NO_FIELDS

Constant indicating that the class has no Serializable fields.

Public methods

forClass

Added in API level 1
Class<?> forClass ()

Returns the class (java.lang.Class) for this descriptor.

Returns
Class<?> the class in the local VM that this descriptor represents; null if there is no corresponding class.

getField

Added in API level 1
ObjectStreamField getField (String name)

Gets a field descriptor of the class represented by this class descriptor.

Parameters
name String: the name of the desired field.
Returns
ObjectStreamField the field identified by name or null if there is no such field.

getFields

Added in API level 1
ObjectStreamField[] getFields ()

Returns a collection of field descriptors for the serialized fields of the class represented by this class descriptor.

Returns
ObjectStreamField[] an array of field descriptors or an array of length zero if there are no fields in this descriptor's class.

getName

Added in API level 1
String getName ()

Returns the name of the class represented by this descriptor.

Returns
String the fully qualified name of the class this descriptor represents.

getSerialVersionUID

Added in API level 1
long getSerialVersionUID ()

Returns the Serial Version User ID of the class represented by this descriptor.

Returns
long the SUID for the class represented by this descriptor.

lookup

Added in API level 1
ObjectStreamClass lookup (Class<?> cl)

Returns the descriptor for a serializable class. Returns null if the class doesn't implement Serializable or Externalizable.

Parameters
cl Class: a java.lang.Class for which to obtain the corresponding descriptor
Returns
ObjectStreamClass the corresponding descriptor if the class is serializable or externalizable; null otherwise.

lookupAny

Added in API level 9
ObjectStreamClass lookupAny (Class<?> cl)

Returns the descriptor for any class, whether or not the class implements Serializable or Externalizable.

Parameters
cl Class: a java.lang.Class for which to obtain the corresponding descriptor
Returns
ObjectStreamClass the descriptor

toString

Added in API level 1
String toString ()

Returns a string containing a concise, human-readable description of this descriptor.

Returns
String a printable representation of this descriptor.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.