The class is 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.

Class declaration

Following is the declaration for class −

public class ObjectStreamClass
   extends Object
      implements Serializable


Following are the fields for class −

  • static ObjectStreamField[] NO_FIELDS − This is the serialPersistentFields value indicating no serializable fields.

Class methods

S.N. Method & Description
1 Class<?> forClass()

This method returns the class in the local VM that this version is mapped to.

2 ObjectStreamField getField(String name)

This method gets the field of this class by name.

3 ObjectStreamField[] getFields()

This method returns an array of the fields of this serializable class.

4 String getName()

This method returns the name of the class described by this descriptor.

5 long getSerialVersionUID()

This method returns the serialVersionUID for this class.

6 static ObjectStreamClass lookup(Class<?> cl)

This method finds the descriptor for a class that can be serialized.

7 static ObjectStreamClass lookupAny(Class<?> cl)

This method returns the descriptor for any class, regardless of whether it implements Serializable.

8 String toString()

This method returns a string describing this ObjectStreamClass.

Methods inherited

This class inherits methods from the following classes −