Java in a Nutshell, 5th Edition [Electronic resources]

نسخه متنی -صفحه : 1191/ 160
نمايش فراداده

This class represents a named field of a specified type (i.e., a specified Class). When a class serializes itself by writing a set of fields that are different from the fields it uses in its own implementation, it defines the set of fields to be written with an array of ObjectStreamField objects. This array should be the value of a private static field named serialPersistentFields. The methods of this class are used internally by the serialization mechanism and are not typically used elsewhere. See also ObjectOutputStream.PutField and ObjectInputStream.GetField.

Figure 9-41. java.io.ObjectStreamField

public class 

ObjectStreamField implements Comparable<Object> { // Public Constructors public

ObjectStreamField (String

name , Class<?>

type );

1.4 public

ObjectStreamField (String

name , Class<?>

type , boolean

unshared ); // Public Instance Methods public String

getName ( ); public int

getOffset ( ); public Class<?>

getType ( ); public char

getTypeCode ( ); public String

getTypeString ( ); public boolean

isPrimitive ( );

1.4 public boolean

isUnshared ( ); // Methods Implementing Comparable public int

compareTo (Object

obj ); // Public Methods Overriding Object public String

toString ( ); // Protected Instance Methods protected void

setOffset (int

offset ); }

Returned By

ObjectStreamClass.{getField( ), getFields( )}

Type Of

ObjectStreamClass.NO_FIELDS