CONTENTS | PREV | NEXT Java Object Serialization Specification


4.2 The ObjectStreamField Class

ObjectStreamField objects represent serializable fields of serializable classes. The serializable fields of a class can be retrieved from the ObjectStreamClass. An array of ObjectStreamFields is used to override the default of serializable fields.

package java.io;

public class ObjectStreamField {

    public ObjectStreamField(String name, Class clazz);

    public String getName();

    public Class getType() throws ClassNotFoundException;

    public String toString();
}
The ObjectStreamField constructor is used to create a new instance of an ObjectStreamField. The argument is the type of the serializable field. For example, Integer.TYPE or java.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.



CONTENTS | PREV | NEXT
Copyright © 1997-1998 Sun Microsystems, Inc. All Rights Reserved.