ObjectInputStream.java revision 6017
2989N/A * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * An ObjectInputStream deserializes primitive data and objects previously 0N/A * written using an ObjectOutputStream. 0N/A * <p>ObjectOutputStream and ObjectInputStream can provide an application with 0N/A * persistent storage for graphs of objects when used with a FileOutputStream 0N/A * and FileInputStream respectively. ObjectInputStream is used to recover 0N/A * those objects previously serialized. Other uses include passing objects 0N/A * between hosts using a socket stream or for marshaling and unmarshaling 0N/A * arguments and parameters in a remote communication system. 0N/A * <p>ObjectInputStream ensures that the types of all objects in the graph 0N/A * created from the stream match the classes present in the Java Virtual 0N/A * Machine. Classes are loaded as required using the standard mechanisms. 0N/A * <p>Only objects that support the java.io.Serializable or 0N/A * java.io.Externalizable interface can be read from streams. 0N/A * <p>The method <code>readObject</code> is used to read an object from the 0N/A * stream. Java's safe casting should be used to get the desired type. In 0N/A * Java, strings and arrays are objects and are treated as objects during 0N/A * serialization. When read they need to be cast to the expected type. 0N/A * <p>Primitive data types can be read from the stream using the appropriate 0N/A * method on DataInput. 0N/A * <p>The default deserialization mechanism for objects restores the contents 0N/A * of each field to the value and type it had when it was written. Fields 0N/A * declared as transient or static are ignored by the deserialization process. 0N/A * References to other objects cause those objects to be read from the stream 0N/A * as necessary. Graphs of objects are restored correctly using a reference 0N/A * sharing mechanism. New objects are always allocated when deserializing, 0N/A * which prevents existing objects from being overwritten. 0N/A * <p>Reading an object is analogous to running the constructors of a new 0N/A * object. Memory is allocated for the object and initialized to zero (NULL). 0N/A * No-arg constructors are invoked for the non-serializable classes and then 0N/A * the fields of the serializable classes are restored from the stream starting 0N/A * with the serializable class closest to java.lang.object and finishing with 0N/A * the object's most specific class. 0N/A * <p>For example to read from a stream as written by the example in 0N/A * ObjectOutputStream: 0N/A * FileInputStream fis = new FileInputStream("t.tmp"); 0N/A * ObjectInputStream ois = new ObjectInputStream(fis); 0N/A * int i = ois.readInt(); 0N/A * String today = (String) ois.readObject(); 0N/A * Date date = (Date) ois.readObject(); 0N/A * <p>Classes control how they are serialized by implementing either the 0N/A * java.io.Serializable or java.io.Externalizable interfaces. 0N/A * <p>Implementing the Serializable interface allows object serialization to 0N/A * save and restore the entire state of the object and it allows classes to 0N/A * evolve between the time the stream is written and the time it is read. It 0N/A * automatically traverses references between objects, saving and restoring 0N/A * <p>Serializable classes that require special handling during the 0N/A * serialization and deserialization process should implement the following 0N/A * private void writeObject(java.io.ObjectOutputStream stream) 0N/A * throws IOException; 0N/A * private void readObject(java.io.ObjectInputStream stream) 0N/A * throws IOException, ClassNotFoundException; 0N/A * private void readObjectNoData() 0N/A * throws ObjectStreamException; 0N/A * <p>The readObject method is responsible for reading and restoring the state 0N/A * of the object for its particular class using data written to the stream by 0N/A * the corresponding writeObject method. The method does not need to concern 0N/A * itself with the state belonging to its superclasses or subclasses. State is 0N/A * restored by reading data from the ObjectInputStream for the individual 0N/A * fields and making assignments to the appropriate fields of the object. 0N/A * Reading primitive data types is supported by DataInput. 0N/A * <p>Any attempt to read object data which exceeds the boundaries of the 0N/A * custom data written by the corresponding writeObject method will cause an 0N/A * OptionalDataException to be thrown with an eof field value of true. 0N/A * Non-object reads which exceed the end of the allotted data will reflect the 0N/A * end of data in the same way that they would indicate the end of the stream: 0N/A * bytewise reads will return -1 as the byte read or number of bytes read, and 0N/A * primitive reads will throw EOFExceptions. If there is no corresponding 0N/A * writeObject method, then the end of default serialized data marks the end of 0N/A * the allotted data. 0N/A * <p>Primitive and object read calls issued from within a readExternal method 0N/A * behave in the same manner--if the stream is already positioned at the end of 0N/A * data written by the corresponding writeExternal method, object reads will 0N/A * throw OptionalDataExceptions with eof set to true, bytewise reads will 0N/A * return -1, and primitive reads will throw EOFExceptions. Note that this 0N/A * behavior does not hold for streams written with the old 0N/A * <code>ObjectStreamConstants.PROTOCOL_VERSION_1</code> protocol, in which the 0N/A * end of data written by writeExternal methods is not demarcated, and hence 0N/A * cannot be detected. 0N/A * <p>The readObjectNoData method is responsible for initializing the state of 0N/A * the object for its particular class in the event that the serialization 0N/A * stream does not list the given class as a superclass of the object being 0N/A * deserialized. This may occur in cases where the receiving party uses a 0N/A * different version of the deserialized instance's class than the sending 0N/A * party, and the receiver's version extends classes that are not extended by 0N/A * the sender's version. This may also occur if the serialization stream has 0N/A * been tampered; hence, readObjectNoData is useful for initializing 0N/A * deserialized objects properly despite a "hostile" or incomplete source 0N/A * <p>Serialization does not read or assign values to the fields of any object 0N/A * that does not implement the java.io.Serializable interface. Subclasses of 0N/A * Objects that are not serializable can be serializable. In this case the 0N/A * non-serializable class must have a no-arg constructor to allow its fields to 0N/A * be initialized. In this case it is the responsibility of the subclass to 0N/A * save and restore the state of the non-serializable class. It is frequently 0N/A * the case that the fields of that class are accessible (public, package, or 0N/A * protected) or that there are get and set methods that can be used to restore 0N/A * <p>Any exception that occurs while deserializing an object will be caught by 0N/A * the ObjectInputStream and abort the reading process. 0N/A * <p>Implementing the Externalizable interface allows the object to assume 0N/A * complete control over the contents and format of the object's serialized 0N/A * form. The methods of the Externalizable interface, writeExternal and 0N/A * readExternal, are called to save and restore the objects state. When 0N/A * implemented by a class they can write and read their own state using all of 0N/A * the methods of ObjectOutput and ObjectInput. It is the responsibility of 0N/A * the objects to handle any versioning that occurs. 0N/A * <p>Enum constants are deserialized differently than ordinary serializable or 0N/A * externalizable objects. The serialized form of an enum constant consists 0N/A * solely of its name; field values of the constant are not transmitted. To 0N/A * deserialize an enum constant, ObjectInputStream reads the constant name from 0N/A * the stream; the deserialized constant is then obtained by calling the static 0N/A * method <code>Enum.valueOf(Class, String)</code> with the enum constant's 0N/A * base type and the received constant name as arguments. Like other 0N/A * serializable or externalizable objects, enum constants can function as the 0N/A * targets of back references appearing subsequently in the serialization 0N/A * stream. The process by which enum constants are deserialized cannot be 0N/A * customized: any class-specific readObject, readObjectNoData, and readResolve 0N/A * methods defined by enum types are ignored during deserialization. 0N/A * Similarly, any serialPersistentFields or serialVersionUID field declarations 0N/A * are also ignored--all enum types have a fixed serialVersionUID of 0L. 0N/A * @author Mike Warres 0N/A * @author Roger Riggs 0N/A * @see java.io.DataInput 0N/A * @see java.io.ObjectOutputStream 0N/A * @see java.io.Serializable 0N/A /** handle value representing null */ 0N/A /** marker for unshared objects in internal handle table */ 0N/A /** table mapping primitive type names to corresponding class objects */ 0N/A /** cache of subclass security audit results */ 0N/A /** queue for WeakReferences to audited subclasses */ 0N/A /** filter stream for handling block data conversion */ 0N/A /** validation callback list */ 0N/A /** recursion depth */ 0N/A /** whether stream is closed */ 0N/A /** scratch field for passing handle values up/down call stack */ 0N/A /** flag set when at end of field value block with no TC_ENDBLOCKDATA */ 0N/A /** buffer for reading primitive field values */ 0N/A /** if true, invoke readObjectOverride() instead of readObject() */ 0N/A /** if true, invoke resolveObject() */ 0N/A * Context during upcalls to class-defined readObject methods; holds 0N/A * object currently being deserialized and descriptor for current class. 0N/A * Null when not during readObject upcall. 0N/A * Creates an ObjectInputStream that reads from the specified InputStream. 0N/A * A serialization stream header is read from the stream and verified. 0N/A * This constructor will block until the corresponding ObjectOutputStream 0N/A * has written and flushed the header. 0N/A * <p>If a security manager is installed, this constructor will check for 0N/A * the "enableSubclassImplementation" SerializablePermission when invoked 0N/A * directly or indirectly by the constructor of a subclass which overrides 0N/A * the ObjectInputStream.readFields or ObjectInputStream.readUnshared 0N/A * @param in input stream to read from 0N/A * @throws StreamCorruptedException if the stream header is incorrect 0N/A * @throws IOException if an I/O error occurs while reading stream header 0N/A * @throws SecurityException if untrusted subclass illegally overrides 0N/A * security-sensitive methods 0N/A * @throws NullPointerException if <code>in</code> is <code>null</code> 0N/A * @see ObjectInputStream#ObjectInputStream() 0N/A * @see ObjectInputStream#readFields() 0N/A * @see ObjectOutputStream#ObjectOutputStream(OutputStream) 0N/A * Provide a way for subclasses that are completely reimplementing 0N/A * ObjectInputStream to not have to allocate private data just used by this 0N/A * implementation of ObjectInputStream. 0N/A * <p>If there is a security manager installed, this method first calls the 0N/A * security manager's <code>checkPermission</code> method with the 0N/A * <code>SerializablePermission("enableSubclassImplementation")</code> 0N/A * permission to ensure it's ok to enable subclassing. 0N/A * @throws SecurityException if a security manager exists and its 0N/A * <code>checkPermission</code> method denies enabling 0N/A * @see SecurityManager#checkPermission 0N/A * @see java.io.SerializablePermission 0N/A * Read an object from the ObjectInputStream. The class of the object, the 0N/A * signature of the class, and the values of the non-transient and 0N/A * non-static fields of the class and all of its supertypes are read. 0N/A * Default deserializing for a class can be overriden using the writeObject 0N/A * and readObject methods. Objects referenced by this object are read 0N/A * transitively so that a complete equivalent graph of objects is 0N/A * reconstructed by readObject. 0N/A * <p>The root object is completely restored when all of its fields and the 0N/A * objects it references are completely restored. At this point the object 0N/A * validation callbacks are executed in order based on their registered 0N/A * priorities. The callbacks are registered by objects (in the readObject 0N/A * special methods) as they are individually restored. 0N/A * <p>Exceptions are thrown for problems with the InputStream and for 0N/A * classes that should not be deserialized. All exceptions are fatal to 0N/A * the InputStream and leave it in an indeterminate state; it is up to the 0N/A * caller to ignore or recover the stream state. 0N/A * @throws ClassNotFoundException Class of a serialized object cannot be 0N/A * @throws InvalidClassException Something is wrong with a class used by 0N/A * @throws StreamCorruptedException Control information in the 0N/A * stream is inconsistent. 0N/A * @throws OptionalDataException Primitive data was found in the 0N/A * stream instead of objects. 0N/A * @throws IOException Any of the usual Input/Output related exceptions. 0N/A // if nested read, passHandle contains handle of enclosing object 0N/A * This method is called by trusted subclasses of ObjectOutputStream that 0N/A * constructed ObjectOutputStream using the protected no-arg constructor. 0N/A * The subclass is expected to provide an override method with the modifier 0N/A * @return the Object read from the stream. 0N/A * @throws ClassNotFoundException Class definition of a serialized object 0N/A * @throws OptionalDataException Primitive data was found in the stream 0N/A * instead of objects. 0N/A * @throws IOException if I/O errors occurred while reading from the 0N/A * @see #ObjectInputStream() 0N/A * @see #readObject() 0N/A * Reads an "unshared" object from the ObjectInputStream. This method is 0N/A * identical to readObject, except that it prevents subsequent calls to 0N/A * readObject and readUnshared from returning additional references to the 0N/A * deserialized instance obtained via this call. Specifically: 0N/A * <li>If readUnshared is called to deserialize a back-reference (the 0N/A * stream representation of an object which has been written 0N/A * previously to the stream), an ObjectStreamException will be 0N/A * <li>If readUnshared returns successfully, then any subsequent attempts 0N/A * to deserialize back-references to the stream handle deserialized 0N/A * by readUnshared will cause an ObjectStreamException to be thrown. 0N/A * Deserializing an object via readUnshared invalidates the stream handle 0N/A * associated with the returned object. Note that this in itself does not 0N/A * always guarantee that the reference returned by readUnshared is unique; 0N/A * the deserialized object may define a readResolve method which returns an 0N/A * object visible to other parties, or readUnshared may return a Class 0N/A * object or enum constant obtainable elsewhere in the stream or through 0N/A * external means. If the deserialized object defines a readResolve method 0N/A * and the invocation of that method returns an array, then readUnshared 0N/A * returns a shallow clone of that array; this guarantees that the returned 0N/A * array object is unique and cannot be obtained a second time from an 0N/A * invocation of readObject or readUnshared on the ObjectInputStream, 0N/A * even if the underlying data stream has been manipulated. 0N/A * <p>ObjectInputStream subclasses which override this method can only be 0N/A * constructed in security contexts possessing the 0N/A * "enableSubclassImplementation" SerializablePermission; any attempt to 0N/A * instantiate such a subclass without this permission will cause a 0N/A * SecurityException to be thrown. 0N/A * @return reference to deserialized object 0N/A * @throws ClassNotFoundException if class of an object to deserialize 0N/A * @throws StreamCorruptedException if control information in the stream 0N/A * @throws ObjectStreamException if object to deserialize has already 0N/A * appeared in stream 0N/A * @throws OptionalDataException if primitive data is next in stream 0N/A * @throws IOException if an I/O error occurs during deserialization 0N/A // if nested read, passHandle contains handle of enclosing object 0N/A * Read the non-static and non-transient fields of the current class from 0N/A * this stream. This may only be called from the readObject method of the 0N/A * class being deserialized. It will throw the NotActiveException if it is 0N/A * @throws ClassNotFoundException if the class of a serialized object 0N/A * could not be found. 0N/A * @throws IOException if an I/O error occurs. 0N/A * @throws NotActiveException if the stream is not currently reading 0N/A * Fix for 4360508: since stream does not contain terminating 0N/A * TC_ENDBLOCKDATA tag, set flag so that reading code elsewhere 0N/A * knows to simulate end-of-custom-data behavior. 0N/A * Reads the persistent fields from the stream and makes them available by 0N/A * @return the <code>GetField</code> object representing the persistent 0N/A * fields of the object being deserialized 0N/A * @throws ClassNotFoundException if the class of a serialized object 0N/A * could not be found. 0N/A * @throws IOException if an I/O error occurs. 0N/A * @throws NotActiveException if the stream is not currently reading 0N/A * Fix for 4360508: since stream does not contain terminating 0N/A * TC_ENDBLOCKDATA tag, set flag so that reading code elsewhere 0N/A * knows to simulate end-of-custom-data behavior. 0N/A * Register an object to be validated before the graph is returned. While 0N/A * similar to resolveObject these validations are called after the entire 0N/A * graph has been reconstituted. Typically, a readObject method will 0N/A * register the object with the stream so that when all of the objects are 0N/A * restored a final set of validations can be performed. 0N/A * @param obj the object to receive the validation callback. 0N/A * @param prio controls the order of callbacks;zero is a good default. 0N/A * Use higher numbers to be called back earlier, lower numbers for 0N/A * later callbacks. Within a priority, callbacks are processed in 0N/A * no particular order. 0N/A * @throws NotActiveException The stream is not currently reading objects 0N/A * so it is invalid to register a callback. 0N/A * @throws InvalidObjectException The validation object is null. 0N/A * Load the local class equivalent of the specified stream class 0N/A * description. Subclasses may implement this method to allow classes to 0N/A * be fetched from an alternate source. 0N/A * <p>The corresponding method in <code>ObjectOutputStream</code> is 0N/A * <code>annotateClass</code>. This method will be invoked only once for 0N/A * each unique class in the stream. This method can be implemented by 0N/A * subclasses to use an alternate loading mechanism but must return a 0N/A * <code>Class</code> object. Once returned, if the class is not an array 0N/A * class, its serialVersionUID is compared to the serialVersionUID of the 0N/A * serialized class, and if there is a mismatch, the deserialization fails 0N/A * and an {@link InvalidClassException} is thrown. 0N/A * <p>The default implementation of this method in 0N/A * <code>ObjectInputStream</code> returns the result of calling 0N/A * Class.forName(desc.getName(), false, loader) 0N/A * where <code>loader</code> is determined as follows: if there is a 0N/A * method on the current thread's stack whose declaring class was 0N/A * defined by a user-defined class loader (and was not a generated to 0N/A * implement reflective invocations), then <code>loader</code> is class 0N/A * loader corresponding to the closest such method to the currently 0N/A * executing frame; otherwise, <code>loader</code> is 0N/A * <code>null</code>. If this call results in a 0N/A * <code>ClassNotFoundException</code> and the name of the passed 0N/A * <code>ObjectStreamClass</code> instance is the Java language keyword 0N/A * for a primitive type or void, then the <code>Class</code> object 0N/A * representing that primitive type or void will be returned 0N/A * (e.g., an <code>ObjectStreamClass</code> with the name 0N/A * <code>"int"</code> will be resolved to <code>Integer.TYPE</code>). 0N/A * Otherwise, the <code>ClassNotFoundException</code> will be thrown to 0N/A * the caller of this method. 0N/A * @param desc an instance of class <code>ObjectStreamClass</code> 0N/A * @return a <code>Class</code> object corresponding to <code>desc</code> 0N/A * @throws ClassNotFoundException if class of a serialized object cannot 0N/A * Returns a proxy class that implements the interfaces named in a proxy 0N/A * class descriptor; subclasses may implement this method to read custom 0N/A * data from the stream along with the descriptors for dynamic proxy 0N/A * classes, allowing them to use an alternate loading mechanism for the 0N/A * interfaces and the proxy class. 0N/A * <p>This method is called exactly once for each unique proxy class 0N/A * descriptor in the stream. 0N/A * <p>The corresponding method in <code>ObjectOutputStream</code> is 0N/A * <code>annotateProxyClass</code>. For a given subclass of 0N/A * <code>ObjectInputStream</code> that overrides this method, the 0N/A * <code>annotateProxyClass</code> method in the corresponding subclass of 0N/A * <code>ObjectOutputStream</code> must write any data or objects read by 0N/A * <p>The default implementation of this method in 0N/A * <code>ObjectInputStream</code> returns the result of calling 0N/A * <code>Proxy.getProxyClass</code> with the list of <code>Class</code> 0N/A * objects for the interfaces that are named in the <code>interfaces</code> 0N/A * parameter. The <code>Class</code> object for each interface name 0N/A * <code>i</code> is the value returned by calling 0N/A * Class.forName(i, false, loader) 0N/A * where <code>loader</code> is that of the first non-<code>null</code> 0N/A * class loader up the execution stack, or <code>null</code> if no 0N/A * non-<code>null</code> class loaders are on the stack (the same class 0N/A * loader choice used by the <code>resolveClass</code> method). Unless any 0N/A * of the resolved interfaces are non-public, this same value of 0N/A * <code>loader</code> is also the class loader passed to 0N/A * <code>Proxy.getProxyClass</code>; if non-public interfaces are present, 0N/A * their class loader is passed instead (if more than one non-public 0N/A * interface class loader is encountered, an 0N/A * <code>IllegalAccessError</code> is thrown). 0N/A * If <code>Proxy.getProxyClass</code> throws an 0N/A * <code>IllegalArgumentException</code>, <code>resolveProxyClass</code> 0N/A * will throw a <code>ClassNotFoundException</code> containing the 0N/A * <code>IllegalArgumentException</code>. 0N/A * @param interfaces the list of interface names that were 0N/A * deserialized in the proxy class descriptor 0N/A * @return a proxy class for the specified interfaces 0N/A * @throws IOException any exception thrown by the underlying 0N/A * <code>InputStream</code> 0N/A * @throws ClassNotFoundException if the proxy class or any of the 0N/A * named interfaces could not be found 0N/A * @see ObjectOutputStream#annotateProxyClass(Class) 0N/A // define proxy in class loader of non-public interface(s), if any 0N/A "conflicting non-public interface class loaders");
0N/A * This method will allow trusted subclasses of ObjectInputStream to 0N/A * substitute one object for another during deserialization. Replacing 0N/A * objects is disabled until enableResolveObject is called. The 0N/A * enableResolveObject method checks that the stream requesting to resolve 0N/A * object can be trusted. Every reference to serializable objects is passed 0N/A * to resolveObject. To insure that the private state of objects is not 0N/A * unintentionally exposed only trusted streams may use resolveObject. 0N/A * <p>This method is called after an object has been read but before it is 0N/A * returned from readObject. The default resolveObject method just returns 0N/A * <p>When a subclass is replacing objects it must insure that the 0N/A * substituted object is compatible with every field where the reference 0N/A * will be stored. Objects whose type is not a subclass of the type of the 0N/A * field or array element abort the serialization by raising an exception 0N/A * and the object is not be stored. 0N/A * <p>This method is called only once when each object is first 0N/A * encountered. All subsequent references to the object will be redirected 0N/A * to the new object. 0N/A * @param obj object to be substituted 0N/A * @return the substituted object 0N/A * Enable the stream to allow objects read from the stream to be replaced. 0N/A * When enabled, the resolveObject method is called for every object being 0N/A * <p>If <i>enable</i> is true, and there is a security manager installed, 0N/A * this method first calls the security manager's 0N/A * <code>checkPermission</code> method with the 0N/A * <code>SerializablePermission("enableSubstitution")</code> permission to 0N/A * ensure it's ok to enable the stream to allow objects read from the 0N/A * stream to be replaced. 0N/A * @param enable true for enabling use of <code>resolveObject</code> for 0N/A * every object being deserialized 0N/A * @return the previous setting before this method was invoked 0N/A * @throws SecurityException if a security manager exists and its 0N/A * <code>checkPermission</code> method denies enabling the stream 0N/A * to allow objects read from the stream to be replaced. 0N/A * @see SecurityManager#checkPermission 0N/A * @see java.io.SerializablePermission 0N/A * The readStreamHeader method is provided to allow subclasses to read and 0N/A * verify their own stream headers. It reads and verifies the magic number 0N/A * and version number. 0N/A * @throws IOException if there are I/O errors while reading from the 0N/A * underlying <code>InputStream</code> 0N/A * @throws StreamCorruptedException if control information in the stream 0N/A * Read a class descriptor from the serialization stream. This method is 0N/A * called when the ObjectInputStream expects a class descriptor as the next 0N/A * item in the serialization stream. Subclasses of ObjectInputStream may 0N/A * override this method to read in class descriptors that have been written 0N/A * in non-standard formats (by subclasses of ObjectOutputStream which have 0N/A * overridden the <code>writeClassDescriptor</code> method). By default, 0N/A * this method reads class descriptors according to the format defined in 0N/A * the Object Serialization specification. 0N/A * @return the class descriptor read 0N/A * @throws IOException If an I/O error has occurred. 0N/A * @throws ClassNotFoundException If the Class of a serialized object used 0N/A * in the class descriptor representation cannot be found 0N/A * @see java.io.ObjectOutputStream#writeClassDescriptor(java.io.ObjectStreamClass) 0N/A * Reads a byte of data. This method will block if no input is available. 0N/A * @return the byte read, or -1 if the end of the stream is reached. 0N/A * @throws IOException If an I/O error has occurred. 0N/A * Reads into an array of bytes. This method will block until some input 0N/A * is available. Consider using java.io.DataInputStream.readFully to read 0N/A * exactly 'length' bytes. 0N/A * @param buf the buffer into which the data is read 0N/A * @param off the start offset of the data 0N/A * @param len the maximum number of bytes read 0N/A * @return the actual number of bytes read, -1 is returned when the end of 0N/A * the stream is reached. 0N/A * @throws IOException If an I/O error has occurred. 0N/A * @see java.io.DataInputStream#readFully(byte[],int,int) 0N/A * Returns the number of bytes that can be read without blocking. 0N/A * @return the number of available bytes. 0N/A * @throws IOException if there are I/O errors while reading from the 0N/A * underlying <code>InputStream</code> 0N/A * Closes the input stream. Must be called to release any resources 0N/A * associated with the stream. 0N/A * @throws IOException If an I/O error has occurred. 0N/A * Even if stream already closed, propagate redundant close to 0N/A * underlying stream to stay consistent with previous implementations. 0N/A * Reads in a boolean. 0N/A * @return the boolean read. 0N/A * @throws EOFException If end of file is reached. 0N/A * @throws IOException If other I/O error has occurred. 0N/A * Reads an 8 bit byte. 0N/A * @return the 8 bit byte read. 0N/A * @throws EOFException If end of file is reached. 0N/A * @throws IOException If other I/O error has occurred. 0N/A * Reads an unsigned 8 bit byte. 0N/A * @return the 8 bit byte read. 0N/A * @throws EOFException If end of file is reached. 0N/A * @throws IOException If other I/O error has occurred. 0N/A * Reads a 16 bit char. 0N/A * @return the 16 bit char read. 0N/A * @throws EOFException If end of file is reached. 0N/A * @throws IOException If other I/O error has occurred. 0N/A * Reads a 16 bit short. 0N/A * @return the 16 bit short read. 0N/A * @throws EOFException If end of file is reached. 0N/A * @throws IOException If other I/O error has occurred. 0N/A * Reads an unsigned 16 bit short. 0N/A * @return the 16 bit short read. 0N/A * @throws EOFException If end of file is reached. 0N/A * @throws IOException If other I/O error has occurred. 0N/A * Reads a 32 bit int. 0N/A * @return the 32 bit integer read. 0N/A * @throws EOFException If end of file is reached. 0N/A * @throws IOException If other I/O error has occurred. 0N/A * Reads a 64 bit long. 0N/A * @return the read 64 bit long. 0N/A * @throws EOFException If end of file is reached. 0N/A * @throws IOException If other I/O error has occurred. 0N/A * Reads a 32 bit float. 0N/A * @return the 32 bit float read. 0N/A * @throws EOFException If end of file is reached. 0N/A * @throws IOException If other I/O error has occurred. 0N/A * Reads a 64 bit double. 0N/A * @return the 64 bit double read. 0N/A * @throws EOFException If end of file is reached. 0N/A * @throws IOException If other I/O error has occurred. 0N/A * Reads bytes, blocking until all bytes are read. 0N/A * @param buf the buffer into which the data is read 0N/A * @throws EOFException If end of file is reached. 0N/A * @throws IOException If other I/O error has occurred. 0N/A * Reads bytes, blocking until all bytes are read. 0N/A * @param buf the buffer into which the data is read 0N/A * @param off the start offset of the data 0N/A * @param len the maximum number of bytes to read 0N/A * @throws EOFException If end of file is reached. 0N/A * @throws IOException If other I/O error has occurred. 0N/A * @param len the number of bytes to be skipped 0N/A * @return the actual number of bytes skipped. 0N/A * @throws IOException If an I/O error has occurred. 0N/A * Reads in a line that has been terminated by a \n, \r, \r\n or EOF. 0N/A * @return a String copy of the line. 0N/A * @throws IOException if there are I/O errors while reading from the 0N/A * underlying <code>InputStream</code> 0N/A * @deprecated This method does not properly convert bytes to characters. 0N/A * see DataInputStream for the details and alternatives. 0N/A * @return the String. 0N/A * @throws IOException if there are I/O errors while reading from the 0N/A * underlying <code>InputStream</code> 0N/A * @throws UTFDataFormatException if read bytes do not represent a valid 0N/A * modified UTF-8 encoding of a string 0N/A * Provide access to the persistent fields read from the input stream. 0N/A * Get the ObjectStreamClass that describes the fields in the stream. 0N/A * @return the descriptor class that describes the serializable fields 0N/A * Return true if the named field is defaulted and has no value in this 0N/A * @param name the name of the field 0N/A * @return true, if and only if the named field is defaulted 0N/A * @throws IOException if there are I/O errors while reading from 0N/A * the underlying <code>InputStream</code> 0N/A * @throws IllegalArgumentException if <code>name</code> does not 0N/A * correspond to a serializable field 0N/A * Get the value of the named boolean field from the persistent field. 0N/A * @param name the name of the field 0N/A * @param val the default value to use if <code>name</code> does not 0N/A * @return the value of the named <code>boolean</code> field 0N/A * @throws IOException if there are I/O errors while reading from the 0N/A * underlying <code>InputStream</code> 0N/A * @throws IllegalArgumentException if type of <code>name</code> is 0N/A * not serializable or if the field type is incorrect 0N/A * Get the value of the named byte field from the persistent field. 0N/A * @param name the name of the field 0N/A * @param val the default value to use if <code>name</code> does not 0N/A * @return the value of the named <code>byte</code> field 0N/A * @throws IOException if there are I/O errors while reading from the 0N/A * underlying <code>InputStream</code> 0N/A * @throws IllegalArgumentException if type of <code>name</code> is 0N/A * not serializable or if the field type is incorrect 0N/A * Get the value of the named char field from the persistent field. 0N/A * @param name the name of the field 0N/A * @param val the default value to use if <code>name</code> does not 0N/A * @return the value of the named <code>char</code> field 0N/A * @throws IOException if there are I/O errors while reading from the 0N/A * underlying <code>InputStream</code> 0N/A * @throws IllegalArgumentException if type of <code>name</code> is 0N/A * not serializable or if the field type is incorrect 0N/A * Get the value of the named short field from the persistent field. 0N/A * @param name the name of the field 0N/A * @param val the default value to use if <code>name</code> does not 0N/A * @return the value of the named <code>short</code> field 0N/A * @throws IOException if there are I/O errors while reading from the 0N/A * underlying <code>InputStream</code> 0N/A * @throws IllegalArgumentException if type of <code>name</code> is 0N/A * not serializable or if the field type is incorrect 0N/A * Get the value of the named int field from the persistent field. 0N/A * @param name the name of the field 0N/A * @param val the default value to use if <code>name</code> does not 0N/A * @return the value of the named <code>int</code> field 0N/A * @throws IOException if there are I/O errors while reading from the 0N/A * underlying <code>InputStream</code> 0N/A * @throws IllegalArgumentException if type of <code>name</code> is 0N/A * not serializable or if the field type is incorrect 0N/A * Get the value of the named long field from the persistent field. 0N/A * @param name the name of the field 0N/A * @param val the default value to use if <code>name</code> does not 0N/A * @return the value of the named <code>long</code> field 0N/A * @throws IOException if there are I/O errors while reading from the 0N/A * underlying <code>InputStream</code> 0N/A * @throws IllegalArgumentException if type of <code>name</code> is 0N/A * not serializable or if the field type is incorrect 0N/A * Get the value of the named float field from the persistent field. 0N/A * @param name the name of the field 0N/A * @param val the default value to use if <code>name</code> does not 0N/A * @return the value of the named <code>float</code> field 0N/A * @throws IOException if there are I/O errors while reading from the 0N/A * underlying <code>InputStream</code> 0N/A * @throws IllegalArgumentException if type of <code>name</code> is 0N/A * not serializable or if the field type is incorrect 0N/A * Get the value of the named double field from the persistent field. 0N/A * @param name the name of the field 0N/A * @param val the default value to use if <code>name</code> does not 0N/A * @return the value of the named <code>double</code> field 0N/A * @throws IOException if there are I/O errors while reading from the 0N/A * underlying <code>InputStream</code> 0N/A * @throws IllegalArgumentException if type of <code>name</code> is 0N/A * not serializable or if the field type is incorrect 0N/A * Get the value of the named Object field from the persistent field. 0N/A * @param name the name of the field 0N/A * @param val the default value to use if <code>name</code> does not 0N/A * @return the value of the named <code>Object</code> field 0N/A * @throws IOException if there are I/O errors while reading from the 0N/A * underlying <code>InputStream</code> 0N/A * @throws IllegalArgumentException if type of <code>name</code> is 0N/A * not serializable or if the field type is incorrect 0N/A * Verifies that this (possibly subclass) instance can be constructed 0N/A * without violating security constraints: the subclass must not override 0N/A * security-sensitive non-final methods, or else the 0N/A * "enableSubclassImplementation" SerializablePermission is checked. 0N/A * Performs reflective checks on given subclass to verify that it doesn't 0N/A * override security-sensitive non-final methods. Returns true if subclass 0N/A * is "safe", false otherwise. 0N/A * Clears internal data structures. 0N/A * Underlying readObject implementation. 0N/A * Fix for 4360508: stream is currently at the end of a field 0N/A * value block written via default serialization; since there 0N/A * is no terminating TC_ENDBLOCKDATA tag, simulate 0N/A * end-of-custom-data behavior explicitly. 0N/A "unexpected block data");
0N/A "unexpected end of block data");
0N/A * If resolveObject has been enabled and given object does not have an 0N/A * exception associated with it, calls resolveObject to determine 0N/A * replacement for object, and updates handle table accordingly. Returns 0N/A * replacement object, or echoes provided object if no replacement 0N/A * occurred. Expects that passHandle is set to given object's handle prior 0N/A * to calling this method. 0N/A * Reads string without allowing it to be replaced in stream. Called from 0N/A * within ObjectStreamClass.read(). 0N/A * Reads in null code, sets passHandle to NULL_HANDLE and returns null. 0N/A * Reads in object handle, sets passHandle to the read handle, and returns 0N/A * object associated with the handle. 0N/A // REMIND: what type of exception to throw here? 0N/A "cannot read back reference as unshared");
0N/A // REMIND: what type of exception to throw here? 0N/A "cannot read back reference to unshared object");
0N/A * Reads in and returns class object. Sets passHandle to class object's 0N/A * assigned handle. Returns null if class is unresolvable (in which case a 0N/A * ClassNotFoundException will be associated with the class' handle in the 0N/A * Reads in and returns (possibly null) class descriptor. Sets passHandle 0N/A * to class descriptor's assigned handle. If class descriptor cannot be 0N/A * resolved to a class in the local VM, a ClassNotFoundException is 0N/A * associated with the class descriptor's handle. 6017N/A // Return true if this class is a custom subclass of ObjectInputStream 0N/A * Reads in and returns class descriptor for a dynamic proxy class. Sets 0N/A * passHandle to proxy class descriptor's assigned handle. If proxy class 0N/A * descriptor cannot be resolved to a class in the local VM, a 0N/A * ClassNotFoundException is associated with the descriptor's handle. 6017N/A // ReflectUtil.checkProxyPackageAccess makes a test 6017N/A // equivalent to isCustomSubclass so there's no need 6017N/A // to condition this call to isCustomSubclass == true here. 0N/A * Reads in and returns class descriptor for a class that is not a dynamic 0N/A * proxy class. Sets passHandle to class descriptor's assigned handle. If 0N/A * class descriptor cannot be resolved to a class in the local VM, a 0N/A * ClassNotFoundException is associated with the descriptor's handle. 0N/A * Reads in and returns new string. Sets passHandle to new string's 0N/A * Reads in and returns array object, or null if array class is 0N/A * unresolvable. Sets passHandle to array's assigned handle. 0N/A for (
int i =
0; i <
len; i++) {
0N/A for (
int i =
0; i <
len; i++) {
0N/A * Reads in and returns enum constant, or null if enum type is 0N/A * unresolvable. Sets passHandle to enum constant's assigned handle. 0N/A "enum constant " +
name +
" does not exist in " +
0N/A * Reads and returns "ordinary" (i.e., not a String, Class, 0N/A * ObjectStreamClass, array, or enum constant) object, or null if object's 0N/A * class is unresolvable (in which case a ClassNotFoundException will be 0N/A * associated with object's handle). Sets passHandle to object's assigned 0N/A * If obj is non-null, reads externalizable data by invoking readExternal() 0N/A * method of obj; otherwise, attempts to skip over externalizable data. 0N/A * Expects that passHandle is set to obj's handle before this method is 0N/A * In most cases, the handle table has already propagated 0N/A * a CNFException to passHandle at this point; this mark 0N/A * call is included to address cases where the readExternal 0N/A * method has cons'ed and thrown a new CNFException of its 0N/A * At this point, if the externalizable data was not written in 0N/A * block-data form and either the externalizable class doesn't exist 0N/A * locally (i.e., obj == null) or readExternal() just threw a 0N/A * CNFException, then the stream is probably in an inconsistent state, 0N/A * since some (or all) of the externalizable data may not have been 0N/A * consumed. Since there's no "correct" action to take in this case, 0N/A * we mimic the behavior of past serialization implementations and 0N/A * blindly hope that the stream is in sync; if it isn't and additional 0N/A * externalizable data remains in the stream, a subsequent read will 0N/A * most likely throw a StreamCorruptedException. 0N/A * Reads (or attempts to skip, if obj is null or is tagged with a 0N/A * ClassNotFoundException) instance data for each serializable class of 0N/A * object in stream, from superclass to subclass. Expects that passHandle 0N/A * is set to obj's handle before this method is called. 0N/A * In most cases, the handle table has already 0N/A * propagated a CNFException to passHandle at this 0N/A * point; this mark call is included to address cases 0N/A * where the custom readObject method has cons'ed and 0N/A * thrown a new CNFException of its own. 0N/A * defaultDataEnd may have been set indirectly by custom 0N/A * readObject() method when calling defaultReadObject() or 0N/A * readFields(); clear it to restore normal read behavior. 0N/A * Skips over all block data and objects until TC_ENDBLOCKDATA is 0N/A * Reads in values of serializable fields declared by given class 0N/A * descriptor. If obj is non-null, sets field values in obj. Expects that 0N/A * passHandle is set to obj's handle before this method is called. 0N/A // REMIND: is isInstance check necessary? 0N/A * Reads in and returns IOException that caused serialization to abort. 0N/A * All stream state is discarded prior to reading in fatal exception. Sets 0N/A * passHandle to fatal exception's handle. 0N/A * If recursion depth is 0, clears internal data structures; otherwise, 0N/A * throws a StreamCorruptedException. This method is called when a 0N/A * TC_RESET typecode is encountered. 0N/A "unexpected reset; recursion depth: " +
depth);
0N/A * Converts specified span of bytes into float values. 0N/A // REMIND: remove once hotspot inlines Float.intBitsToFloat 0N/A * Converts specified span of bytes into double values. 0N/A // REMIND: remove once hotspot inlines Double.longBitsToDouble 0N/A * Returns the first non-null class loader (not counting class loaders of 0N/A * generated reflection implementation classes) up the execution stack, or 0N/A * null if only code from the null class loader is on the stack. This 0N/A * method is also called via reflection by the following RMI-IIOP class: 0N/A * com.sun.corba.se.internal.util.JDKClassLoader 0N/A * This method should not be removed or its signature changed without 0N/A * corresponding modifications to the above class. 0N/A // REMIND: change name to something more accurate? 0N/A * Default GetField implementation. 0N/A /** class descriptor describing serializable fields */ 0N/A /** primitive field values */ 0N/A /** object field values */ 0N/A /** object field value handles */ 0N/A * Creates GetFieldImpl object for reading fields defined in given 0N/A * Reads primitive and object field values from stream. 0N/A * Returns offset of field with given name and type. A specified type 0N/A * of null matches all types, Object.class matches all non-primitive 0N/A * types, and any other non-null type matches assignable types only. 0N/A * If no matching field is found in the (incoming) class 0N/A * descriptor but a matching field is present in the associated local 0N/A * class descriptor, returns -1. Throws IllegalArgumentException if 0N/A * neither incoming nor local class descriptor contains a match. 0N/A * Prioritized list of callbacks to be performed once object graph has been 0N/A * completely deserialized. 0N/A /** linked list of callbacks */ 0N/A * Creates new (empty) ValidationList. 0N/A * Registers callback. Throws InvalidObjectException if callback 0N/A * Invokes all registered callbacks and clears the callback list. 0N/A * Callbacks with higher priorities are called first; those with equal 0N/A * priorities may be called in any order. If any of the callbacks 0N/A * throws an InvalidObjectException, the callback process is terminated 0N/A * and the exception propagated upwards. 0N/A * Resets the callback list to its initial (empty) state. 0N/A * Input stream supporting single-byte peek operations. 0N/A /** underlying stream */ 0N/A * Creates new PeekInputStream on top of given underlying stream. 0N/A * Peeks at next byte value in stream. Similar to read(), except 0N/A * that it does not consume the read value. 0N/A return (n >=
0) ? (n +
1) :
1;
0N/A * Input stream with two modes: in default mode, inputs data written in the 0N/A * same format as DataOutputStream; in "block data" mode, inputs data 0N/A * bracketed by block data markers (see object serialization specification 0N/A * for details). Buffering depends on block data mode: when in default 0N/A * mode, no data is buffered in advance; when in block data mode, all data 0N/A * for the current data block is read in at once (and buffered). 0N/A /** maximum data block length */ 0N/A /** maximum data block header length */ 0N/A /** (tunable) length of char buffer (for reading strings) */ 0N/A /** readBlockHeader() return value indicating header read may block */ 0N/A /** buffer for reading block data headers */ 0N/A /** char buffer for fast string reads */ 0N/A /** block data mode */ 0N/A // block data state fields; values meaningful only when blkmode true 0N/A /** current offset into buf */ 0N/A /** end offset of valid data in buf, or -1 if no more block data */ 0N/A /** number of bytes in current block yet to be read from stream */ 0N/A /** underlying stream (wrapped in peekable filter stream) */ 0N/A /** loopback stream (for data reads that span data blocks) */ 0N/A * Creates new BlockDataInputStream on top of given underlying stream. 0N/A * Block data mode is turned off by default. 0N/A * Sets block data mode to the given mode (true == on, false == off) 0N/A * and returns the previous mode value. If the new mode is the same as 0N/A * the old mode, no action is taken. Throws IllegalStateException if 0N/A * block data mode is being switched from on to off while unconsumed 0N/A * block data is still present in the stream. 0N/A * Returns true if the stream is currently in block data mode, false 0N/A * If in block data mode, skips to the end of the current group of data 0N/A * blocks (but does not unset block data mode). If not in block data 0N/A * mode, throws an IllegalStateException. 0N/A * Attempts to read in the next block data header (if any). If 0N/A * canBlock is false and a full header cannot be read without possibly 0N/A * blocking, returns HEADER_BLOCKED, else if the next element in the 0N/A * stream is a block data header, returns the block data length 0N/A * specified by the header, else returns -1. 0N/A * Fix for 4360508: stream is currently at the end of a field 0N/A * value block written via default serialization; since there 0N/A * is no terminating TC_ENDBLOCKDATA tag, simulate 0N/A * end-of-custom-data behavior explicitly. 0N/A "illegal block data header length: " +
0N/A * TC_RESETs may occur in between data blocks. 0N/A * Unfortunately, this case must be parsed at a lower 0N/A * level than other typecodes, since primitive data 0N/A * reads may span data blocks separated by a TC_RESET. 0N/A "unexpected EOF while reading block data header");
0N/A * Refills internal buffer buf with block data. Any data in buf at the 0N/A * time of the call is considered consumed. Sets the pos, end, and 0N/A * unread fields to reflect the new amount of available block data; if 0N/A * the next element in the stream is not a data block, sets pos and 0N/A * unread to 0 and end to -1. 0N/A "unexpected EOF in middle of data block");
0N/A * If in block data mode, returns the number of unconsumed bytes 0N/A * remaining in the current data block. If not in block data mode, 0N/A * throws an IllegalStateException. 0N/A * Peeks at (but does not consume) and returns the next byte value in 0N/A * data mode) has been reached. 0N/A * Peeks at (but does not consume) and returns the next byte value in 0N/A /* ----------------- generic input stream methods ------------------ */ 0N/A * The following methods are equivalent to their counterparts in 0N/A * InputStream, except that they interpret data block boundaries and 0N/A * read the requested data from within data blocks when in block data 0N/A // avoid unnecessary call to in.available() if possible 0N/A * Attempts to read len bytes into byte array b at offset off. Returns 0N/A * been reached. If copy is true, reads values into an intermediate 0N/A * buffer before copying them to b (to avoid exposing a reference to 0N/A /* ----------------- primitive data input methods ------------------ */ 0N/A * The following methods are equivalent to their counterparts in 0N/A * DataInputStream, except that they interpret data block boundaries 0N/A * and read the requested data from within data blocks when in block 0N/A /* -------------- primitive data array input methods --------------- */ 0N/A * The following methods read in spans of primitive data values. 0N/A * Though equivalent to calling the corresponding primitive read 0N/A * methods repeatedly, these methods are optimized for reading groups 0N/A * of primitive data values more efficiently. 0N/A * Reads in string written in "long" UTF format. "Long" UTF format is 0N/A * identical to standard UTF, except that it uses an 8 byte header 0N/A * (instead of the standard 2 bytes) to convey the UTF encoding length. 0N/A * Reads in the "body" (i.e., the UTF representation minus the 2-byte 0N/A * or 8-byte length header) of a UTF encoding, which occupies the next 0N/A // near block boundary, read one byte at a time 0N/A // shift and refill buffer manually 0N/A * Reads span of UTF-encoded characters out of internal buffer 0N/A * (starting at offset pos and ending at or before offset end), 0N/A * consuming no more than utflen bytes. Appends read characters to 0N/A * sbuf. Returns the number of bytes consumed. 0N/A // stop short of last char unless all of utf bytes in buffer 0N/A case 7:
// 1 byte format: 0xxxxxxx 0N/A case 13:
// 2 byte format: 110xxxxx 10xxxxxx 0N/A if ((
b2 &
0xC0) !=
0x80) {
0N/A case 14:
// 3 byte format: 1110xxxx 10xxxxxx 10xxxxxx 0N/A if ((
b2 &
0xC0) !=
0x80 || (
b3 &
0xC0) !=
0x80) {
0N/A default:
// 10xx xxxx, 1111 xxxx 0N/A * Fix for 4450867: if a malformed utf char causes the 0N/A * conversion loop to scan past the expected end of the utf 0N/A * string, only consume the expected number of utf bytes. 0N/A * Reads in single UTF-encoded character one byte at a time, appends 0N/A * the character to sbuf, and returns the number of bytes consumed. 0N/A * This method is used when reading in UTF strings written in block 0N/A * data mode to handle UTF-encoded characters which (potentially) 0N/A * straddle block-data boundaries. 0N/A case 7:
// 1 byte format: 0xxxxxxx 0N/A case 13:
// 2 byte format: 110xxxxx 10xxxxxx 0N/A if ((
b2 &
0xC0) !=
0x80) {
0N/A case 14:
// 3 byte format: 1110xxxx 10xxxxxx 10xxxxxx 0N/A if ((
b2 &
0xC0) !=
0x80 || (
b3 &
0xC0) !=
0x80) {
0N/A default:
// 10xx xxxx, 1111 xxxx 0N/A * Unsynchronized table which tracks wire handle to object mappings, as 0N/A * well as ClassNotFoundExceptions associated with deserialized objects. 0N/A * This class implements an exception-propagation algorithm for 0N/A * determining which objects should have ClassNotFoundExceptions associated 0N/A * with them, taking into account cycles and discontinuities (e.g., skipped 0N/A * fields) in the object graph. 0N/A * <p>General use of the table is as follows: during deserialization, a 0N/A * given object is first assigned a handle by calling the assign method. 0N/A * This method leaves the assigned handle in an "open" state, wherein 0N/A * dependencies on the exception status of other handles can be registered 0N/A * by calling the markDependency method, or an exception can be directly 0N/A * associated with the handle by calling markException. When a handle is 0N/A * tagged with an exception, the HandleTable assumes responsibility for 0N/A * propagating the exception to any other objects which depend 0N/A * (transitively) on the exception-tagged object. 0N/A * registered, the handle should be "closed" by calling the finish method 0N/A * on it. The act of finishing a handle allows the exception propagation 0N/A * algorithm to aggressively prune dependency links, lessening the 0N/A * <p>Note that the exception propagation algorithm used depends on handles 0N/A * as memory conservation, it does not enforce this constraint. 0N/A // REMIND: add full description of exception propagation algorithm? 0N/A /* status codes indicating whether object has associated exception */ 0N/A /** array mapping handle -> object status */ 0N/A /** array mapping handle -> list of dependent handles (if any) */ 0N/A /** lowest unresolved dependency */ 0N/A /** number of handles in table */ 0N/A * Creates handle table with the given initial capacity. 0N/A * Assigns next available handle to given object, and returns assigned 0N/A * handle. Once object has been completely deserialized (and all 0N/A * dependencies on other objects identified), the handle should be 0N/A * "closed" by passing it to finish(). 0N/A * Registers a dependency (in exception status) of one handle on 0N/A * another. The dependent handle must be "open" (i.e., assigned, but 0N/A * not finished yet). No action is taken if either dependent or target 0N/A * handle is NULL_HANDLE. 0N/A // ignore dependencies on objs with no exception 0N/A // eagerly propagate exception 0N/A // add to dependency list of target 0N/A // remember lowest unresolved target seen 0N/A * Associates a ClassNotFoundException (if one not already associated) 0N/A * with the currently active handle and propagates it to other 0N/A * referencing objects as appropriate. The specified handle must be 0N/A * "open" (i.e., assigned, but not finished yet). 0N/A // propagate exception to dependents 0N/A * Marks given handle as finished, meaning that no new dependencies 0N/A * will be marked for handle. Calls to the assign and finish methods 0N/A * must occur in LIFO order. 0N/A // no pending unknowns, only resolve current handle 0N/A // pending unknowns now clearable, resolve all upward handles 0N/A // unresolved backrefs present, can't resolve anything yet 0N/A // change STATUS_UNKNOWN -> STATUS_OK in selected span of handles 0N/A * Assigns a new object to the given handle. The object previously 0N/A * associated with the handle is forgotten. This method has no effect 0N/A * if the given handle already has an exception associated with it. 0N/A * This method may be called at any time after the handle is assigned. 0N/A * Looks up and returns object associated with the given handle. 0N/A * Returns null if the given handle is NULL_HANDLE, or if it has an 0N/A * associated ClassNotFoundException. 0N/A * Looks up and returns ClassNotFoundException associated with the 0N/A * given handle. Returns null if the given handle is NULL_HANDLE, or 0N/A * if there is no ClassNotFoundException associated with the handle. 0N/A * Resets table to its initial state. 0N/A * Returns number of handles registered in table. 0N/A * Expands capacity of internal arrays. 0N/A * Simple growable list of (integer) handles. 0N/A * Method for cloning arrays in case of using unsharing reading 0N/A }
else if (
array instanceof boolean[]) {