rt/emul/compact/src/main/java/java/io/ObjectStreamConstants.java
changeset 772 d382dacfd73f
parent 604 3fcc279c921b
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/rt/emul/compact/src/main/java/java/io/ObjectStreamConstants.java	Tue Feb 26 16:54:16 2013 +0100
     1.3 @@ -0,0 +1,215 @@
     1.4 +/*
     1.5 + * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + *
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.  Oracle designates this
    1.11 + * particular file as subject to the "Classpath" exception as provided
    1.12 + * by Oracle in the LICENSE file that accompanied this code.
    1.13 + *
    1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.17 + * version 2 for more details (a copy is included in the LICENSE file that
    1.18 + * accompanied this code).
    1.19 + *
    1.20 + * You should have received a copy of the GNU General Public License version
    1.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.23 + *
    1.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.25 + * or visit www.oracle.com if you need additional information or have any
    1.26 + * questions.
    1.27 + */
    1.28 +
    1.29 +package java.io;
    1.30 +
    1.31 +/**
    1.32 + * Constants written into the Object Serialization Stream.
    1.33 + *
    1.34 + * @author  unascribed
    1.35 + * @since JDK 1.1
    1.36 + */
    1.37 +public interface ObjectStreamConstants {
    1.38 +
    1.39 +    /**
    1.40 +     * Magic number that is written to the stream header.
    1.41 +     */
    1.42 +    final static short STREAM_MAGIC = (short)0xaced;
    1.43 +
    1.44 +    /**
    1.45 +     * Version number that is written to the stream header.
    1.46 +     */
    1.47 +    final static short STREAM_VERSION = 5;
    1.48 +
    1.49 +    /* Each item in the stream is preceded by a tag
    1.50 +     */
    1.51 +
    1.52 +    /**
    1.53 +     * First tag value.
    1.54 +     */
    1.55 +    final static byte TC_BASE = 0x70;
    1.56 +
    1.57 +    /**
    1.58 +     * Null object reference.
    1.59 +     */
    1.60 +    final static byte TC_NULL =         (byte)0x70;
    1.61 +
    1.62 +    /**
    1.63 +     * Reference to an object already written into the stream.
    1.64 +     */
    1.65 +    final static byte TC_REFERENCE =    (byte)0x71;
    1.66 +
    1.67 +    /**
    1.68 +     * new Class Descriptor.
    1.69 +     */
    1.70 +    final static byte TC_CLASSDESC =    (byte)0x72;
    1.71 +
    1.72 +    /**
    1.73 +     * new Object.
    1.74 +     */
    1.75 +    final static byte TC_OBJECT =       (byte)0x73;
    1.76 +
    1.77 +    /**
    1.78 +     * new String.
    1.79 +     */
    1.80 +    final static byte TC_STRING =       (byte)0x74;
    1.81 +
    1.82 +    /**
    1.83 +     * new Array.
    1.84 +     */
    1.85 +    final static byte TC_ARRAY =        (byte)0x75;
    1.86 +
    1.87 +    /**
    1.88 +     * Reference to Class.
    1.89 +     */
    1.90 +    final static byte TC_CLASS =        (byte)0x76;
    1.91 +
    1.92 +    /**
    1.93 +     * Block of optional data. Byte following tag indicates number
    1.94 +     * of bytes in this block data.
    1.95 +     */
    1.96 +    final static byte TC_BLOCKDATA =    (byte)0x77;
    1.97 +
    1.98 +    /**
    1.99 +     * End of optional block data blocks for an object.
   1.100 +     */
   1.101 +    final static byte TC_ENDBLOCKDATA = (byte)0x78;
   1.102 +
   1.103 +    /**
   1.104 +     * Reset stream context. All handles written into stream are reset.
   1.105 +     */
   1.106 +    final static byte TC_RESET =        (byte)0x79;
   1.107 +
   1.108 +    /**
   1.109 +     * long Block data. The long following the tag indicates the
   1.110 +     * number of bytes in this block data.
   1.111 +     */
   1.112 +    final static byte TC_BLOCKDATALONG= (byte)0x7A;
   1.113 +
   1.114 +    /**
   1.115 +     * Exception during write.
   1.116 +     */
   1.117 +    final static byte TC_EXCEPTION =    (byte)0x7B;
   1.118 +
   1.119 +    /**
   1.120 +     * Long string.
   1.121 +     */
   1.122 +    final static byte TC_LONGSTRING =   (byte)0x7C;
   1.123 +
   1.124 +    /**
   1.125 +     * new Proxy Class Descriptor.
   1.126 +     */
   1.127 +    final static byte TC_PROXYCLASSDESC =       (byte)0x7D;
   1.128 +
   1.129 +    /**
   1.130 +     * new Enum constant.
   1.131 +     * @since 1.5
   1.132 +     */
   1.133 +    final static byte TC_ENUM =         (byte)0x7E;
   1.134 +
   1.135 +    /**
   1.136 +     * Last tag value.
   1.137 +     */
   1.138 +    final static byte TC_MAX =          (byte)0x7E;
   1.139 +
   1.140 +    /**
   1.141 +     * First wire handle to be assigned.
   1.142 +     */
   1.143 +    final static int baseWireHandle = 0x7e0000;
   1.144 +
   1.145 +
   1.146 +    /******************************************************/
   1.147 +    /* Bit masks for ObjectStreamClass flag.*/
   1.148 +
   1.149 +    /**
   1.150 +     * Bit mask for ObjectStreamClass flag. Indicates a Serializable class
   1.151 +     * defines its own writeObject method.
   1.152 +     */
   1.153 +    final static byte SC_WRITE_METHOD = 0x01;
   1.154 +
   1.155 +    /**
   1.156 +     * Bit mask for ObjectStreamClass flag. Indicates Externalizable data
   1.157 +     * written in Block Data mode.
   1.158 +     * Added for PROTOCOL_VERSION_2.
   1.159 +     *
   1.160 +     * @see #PROTOCOL_VERSION_2
   1.161 +     * @since 1.2
   1.162 +     */
   1.163 +    final static byte SC_BLOCK_DATA = 0x08;
   1.164 +
   1.165 +    /**
   1.166 +     * Bit mask for ObjectStreamClass flag. Indicates class is Serializable.
   1.167 +     */
   1.168 +    final static byte SC_SERIALIZABLE = 0x02;
   1.169 +
   1.170 +    /**
   1.171 +     * Bit mask for ObjectStreamClass flag. Indicates class is Externalizable.
   1.172 +     */
   1.173 +    final static byte SC_EXTERNALIZABLE = 0x04;
   1.174 +
   1.175 +    /**
   1.176 +     * Bit mask for ObjectStreamClass flag. Indicates class is an enum type.
   1.177 +     * @since 1.5
   1.178 +     */
   1.179 +    final static byte SC_ENUM = 0x10;
   1.180 +
   1.181 +
   1.182 +    /* *******************************************************************/
   1.183 +    /* Security permissions */
   1.184 +
   1.185 +   /**
   1.186 +    * A Stream Protocol Version. <p>
   1.187 +    *
   1.188 +    * All externalizable data is written in JDK 1.1 external data
   1.189 +    * format after calling this method. This version is needed to write
   1.190 +    * streams containing Externalizable data that can be read by
   1.191 +    * pre-JDK 1.1.6 JVMs.
   1.192 +    *
   1.193 +    * @see java.io.ObjectOutputStream#useProtocolVersion(int)
   1.194 +    * @since 1.2
   1.195 +    */
   1.196 +    public final static int PROTOCOL_VERSION_1 = 1;
   1.197 +
   1.198 +
   1.199 +   /**
   1.200 +    * A Stream Protocol Version. <p>
   1.201 +    *
   1.202 +    * This protocol is written by JVM 1.2.
   1.203 +    *
   1.204 +    * Externalizable data is written in block data mode and is
   1.205 +    * terminated with TC_ENDBLOCKDATA. Externalizable classdescriptor
   1.206 +    * flags has SC_BLOCK_DATA enabled. JVM 1.1.6 and greater can
   1.207 +    * read this format change.
   1.208 +    *
   1.209 +    * Enables writing a nonSerializable class descriptor into the
   1.210 +    * stream. The serialVersionUID of a nonSerializable class is
   1.211 +    * set to 0L.
   1.212 +    *
   1.213 +    * @see java.io.ObjectOutputStream#useProtocolVersion(int)
   1.214 +    * @see #SC_BLOCK_DATA
   1.215 +    * @since 1.2
   1.216 +    */
   1.217 +    public final static int PROTOCOL_VERSION_2 = 2;
   1.218 +}