Javatpoint Logo
Javatpoint Logo

Java ObjectStreamField class

A description of a Serializable field from a Serializable class. An array of ObjectStreamFields is used to declare the Serializable fields of a class.

The name) method gets the field of this class by name.


Constructor Description
ObjectStreamField(String name, Class<?> type) It creates a Serializable field with the specified type.
ObjectStreamField(String name, Class<?> type, boolean unshared) It creates an ObjectStreamField representing a serializable field with the given name and type.


Modifier and Type Method Description
int compareTo(Object obj) It compares this field with another ObjectStreamField.
String getName() It gets the name of this field.
int GetOffset() Offset of field within instance data.
Class<?> getType() It get the type of the field.
char getTypeCode() It returns character encoding of field type.
String getTypeString() It return the JVM type signature.
boolean isPrimitive() It return true if this field has a primitive type.
boolean isUnshared() It returns boolean value indicating whether or not the serializable field represented by this ObjectStreamField instance is unshared.
protected void setOffset(int offset) Offset within instance data.
String toString() It return a string that describes this field.

public char getTypeCode()

Returns character encoding of field type. The encoding is as follows:

B byte
C char
D double
F float
I int
J long
L class or interface
S short
Z boolean
[ array


the typecode of the serializable field



I value
Z isTimeSet

Next TopicJava Console Class

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA