ObjectStreamConstants interface in Java

java.io.ObjectStreamConstants

Constants are written into the Object Serialization Stream.

Implementing Classes:

ObjectInputStream, ObjectOutputStream

Declaration

public interface ObjectStreamConstants {

        static final short STREAM_MAGIC = (short) 0xaced;

        static final short STREAM_VERSION = 5;

        static final byte TC_BASE = 0x70;

        static final byte TC_NULL = (byte) 0x70;

        static final byte TC_REFERENCE = (byte) 0x71;

        static final byte TC_CLASSDESC = (byte) 0x72;

        static final byte TC_OBJECT = (byte) 0x73;

        static final byte TC_STRING = (byte) 0x74;

        static final byte TC_ARRAY = (byte) 0x75;

        static final byte TC_CLASS = (byte) 0x76;

        static final byte TC_BLOCKDATA = (byte) 0x77;

        static final byte TC_ENDBLOCKDATA = (byte) 0x78;

        static final byte TC_RESET = (byte) 0x79;

        static final byte TC_BLOCKDATALONG = (byte) 0x7A;

        static final byte TC_EXCEPTION = (byte) 0x7B;

        static final byte TC_LONGSTRING = (byte) 0x7C;

        static final byte TC_PROXYCLASSDESC = (byte) 0x7D;

        static final byte TC_ENUM = (byte) 0x7E;

        static final byte TC_MAX = (byte) 0x7E;

        static final int baseWireHandle = 0x7e0000;

        static final byte SC_WRITE_METHOD = 0x01;

        static final byte SC_BLOCK_DATA = 0x08;

        static final byte SC_SERIALIZABLE = 0x02;

        static final byte SC_EXTERNALIZABLE = 0x04;

        static final byte SC_ENUM = 0x10;

        static final SerializablePermission SUBSTITUTION_PERMISSION = new SerializablePermission("enableSubstitution");

        static final SerializablePermission SUBCLASS_IMPLEMENTATION_PERMISSION = new SerializablePermission(
                "enableSubclassImplementation");

        static final SerializablePermission SERIAL_FILTER_PERMISSION = new SerializablePermission("serialFilter");

        public static final int PROTOCOL_VERSION_1 = 1;

        public static final int PROTOCOL_VERSION_2 = 2;
    }


1. short java.io.ObjectStreamConstants.STREAM_MAGIC: -21267 [0xaced]

The magic number is written to the stream header.

2. short java.io.ObjectStreamConstants.STREAM_VERSION: 5 [0x5]

the version number that is written to the stream header.

3. byte java.io.ObjectStreamConstants.TC_BASE: 112 [0x70]

First tag value.

4. byte java.io.ObjectStreamConstants.TC_NULL: 112 [0x70]

Null object reference.

5. byte java.io.ObjectStreamConstants.TC_REFERENCE: 113 [0x71]

Reference to an object already written into the stream.

6. byte java.io.ObjectStreamConstants.TC_CLASSDESC: 114 [0x72]

new Class Descriptor.

7. byte java.io.ObjectStreamConstants.TC_OBJECT: 115 [0x73]

new Object.

8. byte java.io.ObjectStreamConstants.TC_STRING: 116 [0x74]

new String.

9. byte java.io.ObjectStreamConstants.TC_ARRAY: 117 [0x75]

new Array.

10. byte java.io.ObjectStreamConstants.TC_CLASS: 118 [0x76]

Reference to Class.

11. byte java.io.ObjectStreamConstants.TC_BLOCKDATA: 119 [0x77]

Block of optional data. The byte following tag indicates a number of bytes in this block data.

12. byte java.io.ObjectStreamConstants.TC_ENDBLOCKDATA: 120 [0x78]

End of optional block data blocks for an object.

13. byte java.io.ObjectStreamConstants.TC_RESET : 121 [0x79]

Reset stream context. All handles written into the stream are reset.

14. byte java.io.ObjectStreamConstants.TC_BLOCKDATALONG : 122 [0x7a]

long Block data. The long following the tag indicates the number of bytes in the data of this block.

15. byte java.io.ObjectStreamConstants.TC_EXCEPTION : 123 [0x7b]

Exception during writing.

16. byte java.io.ObjectStreamConstants.TC_LONGSTRING : 124 [0x7c]

Long string.

17. byte java.io.ObjectStreamConstants.TC_PROXYCLASSDESC : 125 [0x7d]

new Proxy Class Descriptor.

18. byte java.io.ObjectStreamConstants.TC_ENUM : 126 [0x7e]

new Enum constant.

19. byte java.io.ObjectStreamConstants.TC_MAX : 126 [0x7e]

Last tag value.

20. int java.io.ObjectStreamConstants.baseWireHandle : 8257536 [0x7e0000]

The first wire handle is to be assigned.

21. byte java.io.ObjectStreamConstants.SC_WRITE_METHOD : 1 [0x1]

Bitmask for ObjectStreamClass flag. Indicates a Serializable class defines its own writeObject method.

22. byte java.io.ObjectStreamConstants.SC_BLOCK_DATA: 8 [0x8]

Bitmask for ObjectStreamClass flag. Indicates Externalizable data written in Block Data mode. Added for PROTOCOL_VERSION_2.

23. byte java.io.ObjectStreamConstants.SC_SERIALIZABLE: 2 [0x2]

Bitmask for ObjectStreamClass flag. Indicates class is Serializable.

24. byte java.io.ObjectStreamConstants.SC_EXTERNALIZABLE : 4 [0x4]

Bitmask for ObjectStreamClass flag. Indicates class is Externalizable.

25. byte java.io.ObjectStreamConstants.SC_ENUM : 16 [0x10]

Bitmask for ObjectStreamClass flag. Indicates class is an enum type.

25. SerializablePermission java.io.ObjectStreamConstants.SUBSTITUTION_PERMISSION.

Enable substitution of one object for another during serialization/deserialization.

26. SerializablePermission java.io.ObjectStreamConstants.SUBCLASS_IMPLEMENTATION_PERMISSION

Enable overriding of readObject and writeObject.

27. SerializablePermission java.io.ObjectStreamConstants.SERIAL_FILTER_PERMISSION

Enable setting the system-wide serial filter.

28. int java.io.ObjectStreamConstants.PROTOCOL_VERSION_1: 1 [0x1]

A Stream Protocol Version. All externalizable data is written in JDK 1.1 external data format after calling this method. This version is needed to write streams containing Externalizable data that can be read by pre-JDK 1.1.6 JVMs.

29. int java.io.ObjectStreamConstants.PROTOCOL_VERSION_2 : 2 [0x2]

 A Stream Protocol Version. This protocol is written by JVM 1.2. Externalizable data is written in block data mode and is terminated with TC_ENDBLOCKDATA. Externalizable class descriptor flags have SC_BLOCK_DATA enabled. JVM 1.1.6 and greater can read this format change. Enables writing a non-serializable class descriptor into the stream. The serialVersionUID of a non-serializable class is set to 0L.


Serializable interface in Java

ObjectInputValidation interface in Java

ObjectInputFilter interface in Java

DataOutput interface in Java

ObjectInput interface in Java

ObjectStreamConstants interface in Java

ObjectOutput interface in Java

No comments:

Post a Comment