English 中文(简体)
Java.io package classes

Java.io package extras

Java.io package Useful Resources

Selected Reading

Java.io - ObjectStreamField
  • 时间:2024-09-17

Java.io.ObjectStreamField Class


Previous Page Next Page  

Introduction

The Java.io.ObjectStreamField class is a description of a Seriapzable field from a Seriapzable class. An array of ObjectStreamFields is used to declare the Seriapzable fields of a class.

Class declaration

Following is the declaration for Java.io.ObjectStreamField class −

pubpc class ObjectStreamField
   extends Object
      implements Comparable<Object>

Class constructors

Sr.No. Constructor & Description
1

ObjectStreamField(String name, Class<?> type)

This creates a Seriapzable field with the specified type.

2

ObjectStreamField(String name, Class<?> type, boolean unshared)

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

Class methods

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 seriapzable 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.

Methods inherited

This class inherits methods from the following classes −

    Java.io.Object

Advertisements