iiopinputstream.java

来自「JAVA 所有包」· Java 代码 · 共 1,852 行 · 第 1/5 页

JAVA
1,852
字号
                return activeRecursionMgr.getObject(cdrie.offset);	    }    }    final Object simpleReadObject(Class clz,                                  String repositoryID,                                  com.sun.org.omg.SendingContext.CodeBase sender,                                  int offset)					 /* throws OptionalDataException, ClassNotFoundException, IOException */    {    	/* Save the current state and get ready to read an object. */    	Object prevObject = currentObject;    	ObjectStreamClass prevClassDesc = currentClassDesc;        Class prevClass = currentClass;        byte oldStreamFormatVersion = streamFormatVersion;    	simpleReadDepth++;	// Entering    	Object obj = null;    	/*    	 * Check for reset, handle it before reading an object.    	 */    	try {	    // d4365188: backward compatability	    if (vhandler.useFullValueDescription(clz, repositoryID)) {		obj = inputObjectUsingFVD(clz, repositoryID, sender, offset);	    } else {                obj = inputObject(clz, repositoryID, sender, offset);	    }	    obj = currentClassDesc.readResolve(obj);    	}    	catch(ClassNotFoundException cnfe)	    {		bridge.throwException( cnfe ) ;		return null;	    }    	catch(IOException ioe)	    {		// System.out.println("CLZ = " + clz + "; " + ioe.toString());		bridge.throwException(ioe) ;		return null;	    }    	finally {    	    simpleReadDepth --;    	    currentObject = prevObject;    	    currentClassDesc = prevClassDesc;            currentClass = prevClass;            streamFormatVersion = oldStreamFormatVersion;    	}    	/* Check for thrown exceptions and re-throw them, clearing them if    	 * this is the last recursive call .    	 */    	IOException exIOE = abortIOException;    	if (simpleReadDepth == 0)    	    abortIOException = null;    	if (exIOE != null){	    bridge.throwException( exIOE ) ;            return null;    	}    	ClassNotFoundException exCNF = abortClassNotFoundException;    	if (simpleReadDepth == 0)    	    abortClassNotFoundException = null;    	if (exCNF != null) {	    bridge.throwException( exCNF ) ;            return null;    	}    	return obj;    }    public final void simpleSkipObject(String repositoryID,				       com.sun.org.omg.SendingContext.CodeBase sender)				       /* throws OptionalDataException, ClassNotFoundException, IOException */    {				    	/* Save the current state and get ready to read an object. */    	Object prevObject = currentObject;    	ObjectStreamClass prevClassDesc = currentClassDesc;        Class prevClass = currentClass;        byte oldStreamFormatVersion = streamFormatVersion;    	simpleReadDepth++;	// Entering    	Object obj = null;    	/*    	 * Check for reset, handle it before reading an object.    	 */    	try {	    skipObjectUsingFVD(repositoryID, sender);    	}    	catch(ClassNotFoundException cnfe)	    {		bridge.throwException( cnfe ) ;		return;	    }    	catch(IOException ioe)	    {		bridge.throwException( ioe ) ;		return;	    }    	finally {    	    simpleReadDepth --;            streamFormatVersion = oldStreamFormatVersion;    	    currentObject = prevObject;    	    currentClassDesc = prevClassDesc;            currentClass = prevClass;    	}    	/* Check for thrown exceptions and re-throw them, clearing them if    	 * this is the last recursive call .    	 */    	IOException exIOE = abortIOException;    	if (simpleReadDepth == 0)    	    abortIOException = null;    	if (exIOE != null){	    bridge.throwException( exIOE ) ;            return;    	}    	ClassNotFoundException exCNF = abortClassNotFoundException;    	if (simpleReadDepth == 0)    	    abortClassNotFoundException = null;    	if (exCNF != null) {	    bridge.throwException( exCNF ) ;            return;    	}	return;    }    /////////////////    /**     * This method is called by trusted subclasses of ObjectOutputStream     * that constructed ObjectOutputStream using the     * protected no-arg constructor. The subclass is expected to provide     * an override method with the modifier "final".     *     * @return the Object read from the stream.     *     * @see #ObjectInputStream()     * @see #readObject     * @since JDK 1.2     */    protected final Object readObjectOverride() 	throws OptionalDataException, ClassNotFoundException, IOException    {        return readObjectDelegate();    }    /**     * Override the actions of the final method "defaultReadObject()"     * in ObjectInputStream.     * @since     JDK1.1.6     *     * Read the non-static and non-transient fields of the current class     * from this stream.  This may only be called from the readObject method     * of the class being deserialized. It will throw the NotActiveException     * if it is called otherwise.     *     * @exception java.lang.ClassNotFoundException if the class of a serialized     *              object could not be found.     * @exception IOException        if an I/O error occurs.     * @exception NotActiveException if the stream is not currently reading     *              objects.     * @since     JDK1.1     */    public final void defaultReadObjectDelegate()    /* throws IOException, ClassNotFoundException, NotActiveException */    {        try {	    if (currentObject == null || currentClassDesc == null)		// XXX I18N, logging needed.		throw new NotActiveException("defaultReadObjectDelegate");            // The array will be null unless fields were retrieved            // remotely because of a serializable version difference.            // Bug fix for 4365188.  See the definition of            // defaultReadObjectFVDMembers for more information.            if (defaultReadObjectFVDMembers != null &&                defaultReadObjectFVDMembers.length > 0) {                // WARNING:  Be very careful!  What if some of                // these fields actually have to do this, too?                // This works because the defaultReadObjectFVDMembers                // reference is passed to inputClassFields, but                // there is no guarantee that                // defaultReadObjectFVDMembers will point to the                // same array after calling inputClassFields.                // Use the remote fields to unmarshal.                inputClassFields(currentObject,                                  currentClass,                                  currentClassDesc,                                 defaultReadObjectFVDMembers,                                 cbSender);            } else {                // Use the local fields to unmarshal.                ObjectStreamField[] fields =                    currentClassDesc.getFieldsNoCopy();                if (fields.length > 0) {                    inputClassFields(currentObject, currentClass, fields, cbSender);                 }            }        }        catch(NotActiveException nae)	    {		bridge.throwException( nae ) ;	    }        catch(IOException ioe)	    {		bridge.throwException( ioe ) ;	    }        catch(ClassNotFoundException cnfe)	    {		bridge.throwException( cnfe ) ;	    }    }    /**     * Override the actions of the final method "enableResolveObject()"     * in ObjectInputStream.     * @since     JDK1.1.6     *     * Enable the stream to allow objects read from the stream to be replaced.     * If the stream is a trusted class it is allowed to enable replacment.     * Trusted classes are those classes with a classLoader equals null. <p>     *     * When enabled the resolveObject method is called for every object     * being deserialized.     *     * @exception SecurityException The classloader of this stream object is non-null.     * @since     JDK1.1     */    public final boolean enableResolveObjectDelegate(boolean enable)    /* throws SecurityException */    {	return false;    }    // The following three methods allow the implementing orbStream    // to provide mark/reset behavior as defined in java.io.InputStream.    public final void mark(int readAheadLimit) {        orbStream.mark(readAheadLimit);    }        public final boolean markSupported() {        return orbStream.markSupported();    }        public final void reset() throws IOException {        try {            orbStream.reset();        } catch (Error e) {            IOException err = new IOException(e.getMessage());	    err.initCause(e) ;	    throw err ;        }    }    public final int available() throws IOException{        return 0; // unreliable    }    public final void close() throws IOException{        // no op    }    public final int read() throws IOException{        try{            readObjectState.readData(this);            return (orbStream.read_octet() << 0) & 0x000000FF;        } catch (MARSHAL marshalException) {            if (marshalException.minor                 == OMGSystemException.RMIIIOP_OPTIONAL_DATA_INCOMPATIBLE1) {                setState(IN_READ_OBJECT_NO_MORE_OPT_DATA);                return -1;            }            throw marshalException;        } catch(Error e) {	    IOException exc = new IOException(e.getMessage());	    exc.initCause(e) ;	    throw exc ;	}    }    public final int read(byte data[], int offset, int length) throws IOException{        try{            readObjectState.readData(this);            orbStream.read_octet_array(data, offset, length);            return length;        } catch (MARSHAL marshalException) {            if (marshalException.minor                 == OMGSystemException.RMIIIOP_OPTIONAL_DATA_INCOMPATIBLE1) {                setState(IN_READ_OBJECT_NO_MORE_OPT_DATA);                return -1;            }            throw marshalException;        } catch(Error e) {	    IOException exc = new IOException(e.getMessage());	    exc.initCause(e) ;	    throw exc ;	}    }    public final boolean readBoolean() throws IOException{        try{            readObjectState.readData(this);            return orbStream.read_boolean();        } catch (MARSHAL marshalException) {            handleOptionalDataMarshalException(marshalException, false);            throw marshalException;        } catch(Error e) {	    IOException exc = new IOException(e.getMessage());	    exc.initCause(e);	    throw exc ;	}    }    public final byte readByte() throws IOException{        try{            readObjectState.readData(this);            return orbStream.read_octet();        } catch (MARSHAL marshalException) {            handleOptionalDataMarshalException(marshalException, false);            throw marshalException;        } catch(Error e) {	    IOException exc = new IOException(e.getMessage());	    exc.initCause(e);	    throw exc ;	}    }    public final char readChar() throws IOException{        try{            readObjectState.readData(this);            return orbStream.read_wchar();        } catch (MARSHAL marshalException) {            handleOptionalDataMarshalException(marshalException, false);            throw marshalException;        } catch(Error e) {	    IOException exc = new IOException(e.getMessage());	    exc.initCause(e);	    throw exc ;	}    }    public final double readDouble() throws IOException{        try{

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?