📜  Java.io.ObjectStreamField类

📅  最后修改于: 2020-11-15 02:47:38             🧑  作者: Mango


介绍

Java.io.ObjectStreamField类是Serializable类中对Serializable字段的描述。 ObjectStreamFields数组用于声明类的Serializable字段。

类声明

以下是Java.io.ObjectStreamField类的声明-

public class ObjectStreamField
   extends Object
      implements Comparable

类的构造函数

Sr.No. Constructor & Description
1

ObjectStreamField(String name, Class type)

This creates a Serializable field with the specified type.

2

ObjectStreamField(String name, Class type, boolean unshared)

This creates an ObjectStreamField representing a serializable field with the given name and type.

类方法

Sr.No. Method & Description
1 int compareTo(Object obj)

This method compares this field with another ObjectStreamField.

2 String getName()

This method gets the name of this field.

3 int getOffset()

This method returns the offset of field within instance data.

4 Class getType()

This method gets the type of the field.

5 char getTypeCode()

This method returns character encoding of field type.

6 String getTypeString()

This method returns the JVM type signature.

7 boolean isPrimitive()

This method returns true if this field has a primitive type.

8 boolean isUnshared()

This method returns boolean value indicating whether or not the serializable field represented by this ObjectStreamField instance is unshared.

9 protected void setOffset(int offset)

This method returns offset within instance data.

10 String toString()

This method returns a string that describes this field.

方法继承

此类从以下类继承方法-

  • Java对象