jdk/src/java.base/share/classes/java/io/ObjectStreamConstants.java
changeset 32649 2ee9017c7597
parent 25859 3317bb8137f4
child 41230 0a8c1ba2b6fb
equal deleted inserted replaced
32648:1fa861caf840 32649:2ee9017c7597
    34 public interface ObjectStreamConstants {
    34 public interface ObjectStreamConstants {
    35 
    35 
    36     /**
    36     /**
    37      * Magic number that is written to the stream header.
    37      * Magic number that is written to the stream header.
    38      */
    38      */
    39     final static short STREAM_MAGIC = (short)0xaced;
    39     static final short STREAM_MAGIC = (short)0xaced;
    40 
    40 
    41     /**
    41     /**
    42      * Version number that is written to the stream header.
    42      * Version number that is written to the stream header.
    43      */
    43      */
    44     final static short STREAM_VERSION = 5;
    44     static final short STREAM_VERSION = 5;
    45 
    45 
    46     /* Each item in the stream is preceded by a tag
    46     /* Each item in the stream is preceded by a tag
    47      */
    47      */
    48 
    48 
    49     /**
    49     /**
    50      * First tag value.
    50      * First tag value.
    51      */
    51      */
    52     final static byte TC_BASE = 0x70;
    52     static final byte TC_BASE = 0x70;
    53 
    53 
    54     /**
    54     /**
    55      * Null object reference.
    55      * Null object reference.
    56      */
    56      */
    57     final static byte TC_NULL =         (byte)0x70;
    57     static final byte TC_NULL =         (byte)0x70;
    58 
    58 
    59     /**
    59     /**
    60      * Reference to an object already written into the stream.
    60      * Reference to an object already written into the stream.
    61      */
    61      */
    62     final static byte TC_REFERENCE =    (byte)0x71;
    62     static final byte TC_REFERENCE =    (byte)0x71;
    63 
    63 
    64     /**
    64     /**
    65      * new Class Descriptor.
    65      * new Class Descriptor.
    66      */
    66      */
    67     final static byte TC_CLASSDESC =    (byte)0x72;
    67     static final byte TC_CLASSDESC =    (byte)0x72;
    68 
    68 
    69     /**
    69     /**
    70      * new Object.
    70      * new Object.
    71      */
    71      */
    72     final static byte TC_OBJECT =       (byte)0x73;
    72     static final byte TC_OBJECT =       (byte)0x73;
    73 
    73 
    74     /**
    74     /**
    75      * new String.
    75      * new String.
    76      */
    76      */
    77     final static byte TC_STRING =       (byte)0x74;
    77     static final byte TC_STRING =       (byte)0x74;
    78 
    78 
    79     /**
    79     /**
    80      * new Array.
    80      * new Array.
    81      */
    81      */
    82     final static byte TC_ARRAY =        (byte)0x75;
    82     static final byte TC_ARRAY =        (byte)0x75;
    83 
    83 
    84     /**
    84     /**
    85      * Reference to Class.
    85      * Reference to Class.
    86      */
    86      */
    87     final static byte TC_CLASS =        (byte)0x76;
    87     static final byte TC_CLASS =        (byte)0x76;
    88 
    88 
    89     /**
    89     /**
    90      * Block of optional data. Byte following tag indicates number
    90      * Block of optional data. Byte following tag indicates number
    91      * of bytes in this block data.
    91      * of bytes in this block data.
    92      */
    92      */
    93     final static byte TC_BLOCKDATA =    (byte)0x77;
    93     static final byte TC_BLOCKDATA =    (byte)0x77;
    94 
    94 
    95     /**
    95     /**
    96      * End of optional block data blocks for an object.
    96      * End of optional block data blocks for an object.
    97      */
    97      */
    98     final static byte TC_ENDBLOCKDATA = (byte)0x78;
    98     static final byte TC_ENDBLOCKDATA = (byte)0x78;
    99 
    99 
   100     /**
   100     /**
   101      * Reset stream context. All handles written into stream are reset.
   101      * Reset stream context. All handles written into stream are reset.
   102      */
   102      */
   103     final static byte TC_RESET =        (byte)0x79;
   103     static final byte TC_RESET =        (byte)0x79;
   104 
   104 
   105     /**
   105     /**
   106      * long Block data. The long following the tag indicates the
   106      * long Block data. The long following the tag indicates the
   107      * number of bytes in this block data.
   107      * number of bytes in this block data.
   108      */
   108      */
   109     final static byte TC_BLOCKDATALONG= (byte)0x7A;
   109     static final byte TC_BLOCKDATALONG= (byte)0x7A;
   110 
   110 
   111     /**
   111     /**
   112      * Exception during write.
   112      * Exception during write.
   113      */
   113      */
   114     final static byte TC_EXCEPTION =    (byte)0x7B;
   114     static final byte TC_EXCEPTION =    (byte)0x7B;
   115 
   115 
   116     /**
   116     /**
   117      * Long string.
   117      * Long string.
   118      */
   118      */
   119     final static byte TC_LONGSTRING =   (byte)0x7C;
   119     static final byte TC_LONGSTRING =   (byte)0x7C;
   120 
   120 
   121     /**
   121     /**
   122      * new Proxy Class Descriptor.
   122      * new Proxy Class Descriptor.
   123      */
   123      */
   124     final static byte TC_PROXYCLASSDESC =       (byte)0x7D;
   124     static final byte TC_PROXYCLASSDESC =       (byte)0x7D;
   125 
   125 
   126     /**
   126     /**
   127      * new Enum constant.
   127      * new Enum constant.
   128      * @since 1.5
   128      * @since 1.5
   129      */
   129      */
   130     final static byte TC_ENUM =         (byte)0x7E;
   130     static final byte TC_ENUM =         (byte)0x7E;
   131 
   131 
   132     /**
   132     /**
   133      * Last tag value.
   133      * Last tag value.
   134      */
   134      */
   135     final static byte TC_MAX =          (byte)0x7E;
   135     static final byte TC_MAX =          (byte)0x7E;
   136 
   136 
   137     /**
   137     /**
   138      * First wire handle to be assigned.
   138      * First wire handle to be assigned.
   139      */
   139      */
   140     final static int baseWireHandle = 0x7e0000;
   140     static final int baseWireHandle = 0x7e0000;
   141 
   141 
   142 
   142 
   143     /******************************************************/
   143     /******************************************************/
   144     /* Bit masks for ObjectStreamClass flag.*/
   144     /* Bit masks for ObjectStreamClass flag.*/
   145 
   145 
   146     /**
   146     /**
   147      * Bit mask for ObjectStreamClass flag. Indicates a Serializable class
   147      * Bit mask for ObjectStreamClass flag. Indicates a Serializable class
   148      * defines its own writeObject method.
   148      * defines its own writeObject method.
   149      */
   149      */
   150     final static byte SC_WRITE_METHOD = 0x01;
   150     static final byte SC_WRITE_METHOD = 0x01;
   151 
   151 
   152     /**
   152     /**
   153      * Bit mask for ObjectStreamClass flag. Indicates Externalizable data
   153      * Bit mask for ObjectStreamClass flag. Indicates Externalizable data
   154      * written in Block Data mode.
   154      * written in Block Data mode.
   155      * Added for PROTOCOL_VERSION_2.
   155      * Added for PROTOCOL_VERSION_2.
   156      *
   156      *
   157      * @see #PROTOCOL_VERSION_2
   157      * @see #PROTOCOL_VERSION_2
   158      * @since 1.2
   158      * @since 1.2
   159      */
   159      */
   160     final static byte SC_BLOCK_DATA = 0x08;
   160     static final byte SC_BLOCK_DATA = 0x08;
   161 
   161 
   162     /**
   162     /**
   163      * Bit mask for ObjectStreamClass flag. Indicates class is Serializable.
   163      * Bit mask for ObjectStreamClass flag. Indicates class is Serializable.
   164      */
   164      */
   165     final static byte SC_SERIALIZABLE = 0x02;
   165     static final byte SC_SERIALIZABLE = 0x02;
   166 
   166 
   167     /**
   167     /**
   168      * Bit mask for ObjectStreamClass flag. Indicates class is Externalizable.
   168      * Bit mask for ObjectStreamClass flag. Indicates class is Externalizable.
   169      */
   169      */
   170     final static byte SC_EXTERNALIZABLE = 0x04;
   170     static final byte SC_EXTERNALIZABLE = 0x04;
   171 
   171 
   172     /**
   172     /**
   173      * Bit mask for ObjectStreamClass flag. Indicates class is an enum type.
   173      * Bit mask for ObjectStreamClass flag. Indicates class is an enum type.
   174      * @since 1.5
   174      * @since 1.5
   175      */
   175      */
   176     final static byte SC_ENUM = 0x10;
   176     static final byte SC_ENUM = 0x10;
   177 
   177 
   178 
   178 
   179     /* *******************************************************************/
   179     /* *******************************************************************/
   180     /* Security permissions */
   180     /* Security permissions */
   181 
   181 
   185      *
   185      *
   186      * @see java.io.ObjectOutputStream#enableReplaceObject(boolean)
   186      * @see java.io.ObjectOutputStream#enableReplaceObject(boolean)
   187      * @see java.io.ObjectInputStream#enableResolveObject(boolean)
   187      * @see java.io.ObjectInputStream#enableResolveObject(boolean)
   188      * @since 1.2
   188      * @since 1.2
   189      */
   189      */
   190     final static SerializablePermission SUBSTITUTION_PERMISSION =
   190     static final SerializablePermission SUBSTITUTION_PERMISSION =
   191                            new SerializablePermission("enableSubstitution");
   191                            new SerializablePermission("enableSubstitution");
   192 
   192 
   193     /**
   193     /**
   194      * Enable overriding of readObject and writeObject.
   194      * Enable overriding of readObject and writeObject.
   195      *
   195      *
   196      * @see java.io.ObjectOutputStream#writeObjectOverride(Object)
   196      * @see java.io.ObjectOutputStream#writeObjectOverride(Object)
   197      * @see java.io.ObjectInputStream#readObjectOverride()
   197      * @see java.io.ObjectInputStream#readObjectOverride()
   198      * @since 1.2
   198      * @since 1.2
   199      */
   199      */
   200     final static SerializablePermission SUBCLASS_IMPLEMENTATION_PERMISSION =
   200     static final SerializablePermission SUBCLASS_IMPLEMENTATION_PERMISSION =
   201                     new SerializablePermission("enableSubclassImplementation");
   201                     new SerializablePermission("enableSubclassImplementation");
   202    /**
   202    /**
   203     * A Stream Protocol Version. <p>
   203     * A Stream Protocol Version. <p>
   204     *
   204     *
   205     * All externalizable data is written in JDK 1.1 external data
   205     * All externalizable data is written in JDK 1.1 external data
   208     * pre-JDK 1.1.6 JVMs.
   208     * pre-JDK 1.1.6 JVMs.
   209     *
   209     *
   210     * @see java.io.ObjectOutputStream#useProtocolVersion(int)
   210     * @see java.io.ObjectOutputStream#useProtocolVersion(int)
   211     * @since 1.2
   211     * @since 1.2
   212     */
   212     */
   213     public final static int PROTOCOL_VERSION_1 = 1;
   213     public static final int PROTOCOL_VERSION_1 = 1;
   214 
   214 
   215 
   215 
   216    /**
   216    /**
   217     * A Stream Protocol Version. <p>
   217     * A Stream Protocol Version. <p>
   218     *
   218     *
   229     *
   229     *
   230     * @see java.io.ObjectOutputStream#useProtocolVersion(int)
   230     * @see java.io.ObjectOutputStream#useProtocolVersion(int)
   231     * @see #SC_BLOCK_DATA
   231     * @see #SC_BLOCK_DATA
   232     * @since 1.2
   232     * @since 1.2
   233     */
   233     */
   234     public final static int PROTOCOL_VERSION_2 = 2;
   234     public static final int PROTOCOL_VERSION_2 = 2;
   235 }
   235 }