Team LiB
Previous Section Next Section

ObjectStreamConstantsjava.io

Java 1.2

This interface defines various constants used by the Java object-serialization mechanism. Two important constants are PROTOCOL_VERSION_1 and PROTOCOL_VERSION_2, which specify the version of the serialization protocol to use. In Java 1.2, you can pass either of these values to the useProtocolVersion( ) method of an ObjectOutputStream. By default, Java 1.2 uses Version 2 of the protocol, and Java 1.1 uses Version 1 when serializing objects. Java 1.2 can deserialize objects written using either version of the protocol, as can Java 1.1.7 and later. If you want to serialize an object so that it can be read by versions of Java prior to Java 1.1.7, use PROTOCOL_VERSION_1.

The other constants defined by this interface are low-level values used by the serialization protocol. You do not need to use them unless you are reimplementing the serialization mechanism yourself.

public interface ObjectStreamConstants {
// Public Constants
     public static final int baseWireHandle;                             =8257536
     public static final int PROTOCOL_VERSION_1;                         =1
     public static final int PROTOCOL_VERSION_2;                         =2
     public static final byte SC_BLOCK_DATA;                             =8
5.0  public static final byte SC_ENUM; =16
     public static final byte SC_EXTERNALIZABLE;                         =4
     public static final byte SC_SERIALIZABLE;                           =2
     public static final byte SC_WRITE_METHOD;                           =1
     public static final short STREAM_MAGIC;                             =-21267
     public static final short STREAM_VERSION;                           =5
     public static final SerializablePermission SUBCLASS_IMPLEMENTATION_PERMISSION;  
     public static final SerializablePermission SUBSTITUTION_PERMISSION;  
     public static final byte TC_ARRAY;    =117
     public static final byte TC_BASE;     =112
     public static final byte TC_BLOCKDATA;                              =119
     public static final byte TC_BLOCKDATALONG;                          =122
     public static final byte TC_CLASS;    =118
     public static final byte TC_CLASSDESC;                              =114
     public static final byte TC_ENDBLOCKDATA;                           =120
5.0  public static final byte TC_ENUM; =126
     public static final byte TC_EXCEPTION;                              =123
1.3  public static final byte TC_LONGSTRING;                         =124
     public static final byte TC_MAX;      =126
     public static final byte TC_NULL;     =112
     public static final byte TC_OBJECT;   =115
1.3  public static final byte TC_PROXYCLASSDESC;                     =125
     public static final byte TC_REFERENCE;                              =113
     public static final byte TC_RESET;    =121
     public static final byte TC_STRING;   =116
}

Implementations

ObjectInputStream, ObjectOutputStream

    Team LiB
    Previous Section Next Section