CONTENTS | PREV | NEXT | Java Object Serialization Specification |
AnObjectStreamField
represents a serializable field of a serializable class. The serializable fields of a class can be retrieved from theObjectStreamClass
.The special static Serializable field, serialPersistentFields, an array of
ObjectStreamField
componentsis used to override the default serializable fields.
package java.io; public class ObjectStreamField { public ObjectStreamField(String fieldName, Class fieldType); public String getName(); public Class getType() throws ClassNotFoundException; public String toString(); }TheObjectStreamField
constructor is used to create a new instance of anObjectStreamField
. The argument is the type of the serializable field. For example,Integer.TYPE
orjava.lang.Hashtable.class
.ObjectStreamField
objects are used to specify the serializable fields of a class or to describe the fields present in a stream.The
getName
method returns the name of the serializable field.The
getType
method returns the type of the field.The
toString
method returns a printable representation with name and type.