CONTENTS | PREV | NEXT | Java Object Serialization Specification |
The following symbols injava.io.ObjectStreamConstants
define the terminal and constant values expected in a stream.final static short STREAM_MAGIC = (short)0xaced; final static short STREAM_VERSION = 5; final static byte TC_NULL = (byte)0x70; final static byte TC_REFERENCE = (byte)0x71; final static byte TC_CLASSDESC = (byte)0x72; final static byte TC_OBJECT = (byte)0x73; final static byte TC_STRING = (byte)0x74; final static byte TC_ARRAY = (byte)0x75; final static byte TC_CLASS = (byte)0x76; final static byte TC_BLOCKDATA = (byte)0x77; final static byte TC_ENDBLOCKDATA = (byte)0x78; final static byte TC_RESET = (byte)0x79; final static byte TC_BLOCKDATALONG = (byte)0x7A; final static byte TC_EXCEPTION = (byte)0x7B; final static int baseWireHandle = 0x7E0000;The flag byte classDescFlags may include values offinal static byte SC_WRITE_METHOD = 0x01; // if SC_SERIALIZABLE final static byte SC_BLOCK_DATA = 0x01; // if SC_EXTERNALIZABLE final static byte SC_SERIALIZABLE = 0x02; final static byte SC_EXTERNALIZABLE = 0x04;The flag SC_WRITE_METHOD is set if the Serializable class writing the stream had awriteObject
method that may have written additional data to the stream. In this case a TC_ENDBLOCKDATA marker is always expected to terminate the data for that class.The flag SC_BLOCKDATA is set if the
Externalizable
class is written into the stream usingSTREAM_PROTOCOL_2
. By default, this is the protocol used to writeExternalizable
objects into the stream in JDK(tm) 1.2. JDK(tm) 1.1 writes STREAM_PROTOCOL_1.The flag SC_SERIALIZABLE is set if the class that wrote the stream extended
java.io.Serializable
but notjava.io.Externalizable
, the class reading the stream must also extendjava.io.Serializable
and the default serialization mechanism is to be used.The flag SC_EXTERNALIZABLE is set if the class that wrote the stream extended
java.io.Externalizable
, the class reading the data must also extendExternalizable
and the data will be read using itswriteExternal
andreadExternal
methods.