Class IIOPInputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.io.DataInput, java.io.ObjectInput, java.io.ObjectStreamConstants, java.lang.AutoCloseable

    public class IIOPInputStream
    extends InputStreamHook
    IIOPInputStream is used by the ValueHandlerImpl to handle Java serialization input semantics.
    Since:
    JDK1.1.6
    • Field Detail

      • bridge

        private static org.glassfish.pfl.basic.reflection.Bridge bridge
      • defaultReadObjectFVDMembers

        private ValueMember[] defaultReadObjectFVDMembers
      • currentObject

        private java.lang.Object currentObject
      • currentClass

        private java.lang.Class<?> currentClass
      • recursionDepth

        private int recursionDepth
      • simpleReadDepth

        private int simpleReadDepth
      • abortIOException

        private java.io.IOException abortIOException
      • abortClassNotFoundException

        private java.lang.ClassNotFoundException abortClassNotFoundException
      • callbacks

        private java.util.List<java.lang.Object> callbacks
      • classes

        java.lang.Class[] classes
      • spClass

        int spClass
      • kRemoteTypeCode

        public static final TypeCode kRemoteTypeCode
      • kValueTypeCode

        public static final TypeCode kValueTypeCode
      • streamFormatVersion

        private byte streamFormatVersion
    • Constructor Detail

      • IIOPInputStream

        public IIOPInputStream()
                        throws java.io.IOException
        Dummy constructor; passes upper stream a dummy stream;
        Throws:
        java.io.IOException - If an IO error occurs creating this stream.
    • Method Detail

      • streamFormatVersionInfo

        @InfoMethod
        private void streamFormatVersionInfo​(byte sfv)
      • readFormatVersion

        private void readFormatVersion()
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • setTestFVDFlag

        public static void setTestFVDFlag​(boolean val)
      • setOrbStream

        final void setOrbStream​(InputStream os)
      • setSender

        public final void setSender​(CodeBase cb)
      • getSender

        public final CodeBase getSender()
      • setValueHandler

        public final void setValueHandler​(ValueHandler vh)
      • getValueHandler

        public final ValueHandler getValueHandler()
      • recursionDepthInfo

        @InfoMethod
        private void recursionDepthInfo​(int rd)
      • increaseRecursionDepth

        final void increaseRecursionDepth()
      • decreaseRecursionDepth

        final int decreaseRecursionDepth()
      • readObjectDelegate

        public final java.lang.Object readObjectDelegate()
                                                  throws java.lang.ClassNotFoundException,
                                                         java.io.OptionalDataException,
                                                         java.io.StreamCorruptedException,
                                                         java.io.IOException
        Override the actions of the final method "readObject()" in ObjectInputStream. Read an object from the ObjectInputStream. The class of the object, the signature of the class, and the values of the non-transient and non-static fields of the class and all of its supertypes are read. Default deserializing for a class can be overriden using the writeObject and readObject methods. Objects referenced by this object are read transitively so that a complete equivalent graph of objects is reconstructed by readObject.

        The root object is completly restored when all of its fields and the objects it references are completely restored. At this point the object validation callbacks are executed in order based on their registered priorities. The callbacks are registered by objects (in the readObject special methods) as they are individually restored. Exceptions are thrown for problems with the InputStream and for classes that should not be deserialized. All exceptions are fatal to the InputStream and leave it in an indeterminate state; it is up to the caller to ignore or recover the stream state.

        Returns:
        the object read from stream
        Throws:
        java.io.InvalidClassException - Something is wrong with a class used by serialization.
        java.io.StreamCorruptedException - Control information in the stream is inconsistent.
        java.io.OptionalDataException - Primitive data was found in the stream instead of objects.
        java.io.IOException - Any of the usual Input/Output related exceptions.
        java.lang.ClassNotFoundException - Deserialised class could not be found
        Since:
        JDK1.1
      • simpleReadObject

        final java.lang.Object simpleReadObject​(java.lang.Class clz,
                                                ClassInfoCache.ClassInfo cinfo,
                                                java.lang.String repositoryID,
                                                CodeBase sender,
                                                int offset)
      • simpleSkipObject

        public final void simpleSkipObject​(java.lang.String repositoryID,
                                           CodeBase sender)
      • readObjectOverride

        protected final java.lang.Object readObjectOverride()
                                                     throws java.io.OptionalDataException,
                                                            java.lang.ClassNotFoundException,
                                                            java.io.IOException
        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".
        Overrides:
        readObjectOverride in class java.io.ObjectInputStream
        Returns:
        the Object read from the stream.
        Throws:
        java.io.OptionalDataException
        java.lang.ClassNotFoundException
        java.io.IOException
        Since:
        JDK 1.2
        See Also:
        ObjectInputStream.readObject()
      • usingLocalFieldsToRead

        @InfoMethod
        private void usingLocalFieldsToRead()
      • defaultReadObjectDelegate

        public final void defaultReadObjectDelegate()
        Override the actions of the final method "defaultReadObject()" in ObjectInputStream.
        Specified by:
        defaultReadObjectDelegate in class InputStreamHook
        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., JDK1.1
      • enableResolveObjectDelegate

        public final boolean enableResolveObjectDelegate​(boolean enable)
        Override the actions of the final method "enableResolveObject()" in ObjectInputStream. 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.

        When enabled the resolveObject method is called for every object being deserialized.

        Parameters:
        enable - ignored
        Returns:
        false
        Throws:
        java.lang.SecurityException - The classloader of this stream object is non-null.
        Since:
        JDK1.1.6
      • mark

        public final void mark​(int readAheadLimit)
        Overrides:
        mark in class java.io.InputStream
      • markSupported

        public final boolean markSupported()
        Overrides:
        markSupported in class java.io.InputStream
      • reset

        public final void reset()
                         throws java.io.IOException
        Overrides:
        reset in class java.io.InputStream
        Throws:
        java.io.IOException
      • available

        public final int available()
                            throws java.io.IOException
        Specified by:
        available in interface java.io.ObjectInput
        Overrides:
        available in class java.io.ObjectInputStream
        Throws:
        java.io.IOException
      • close

        public final void close()
                         throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in interface java.io.ObjectInput
        Overrides:
        close in class java.io.ObjectInputStream
        Throws:
        java.io.IOException
      • read

        public final int read()
                       throws java.io.IOException
        Specified by:
        read in interface java.io.ObjectInput
        Overrides:
        read in class java.io.ObjectInputStream
        Throws:
        java.io.IOException
      • read

        public final int read​(byte[] data,
                              int offset,
                              int length)
                       throws java.io.IOException
        Specified by:
        read in interface java.io.ObjectInput
        Overrides:
        read in class java.io.ObjectInputStream
        Throws:
        java.io.IOException
      • readBoolean

        public final boolean readBoolean()
                                  throws java.io.IOException
        Specified by:
        readBoolean in interface java.io.DataInput
        Overrides:
        readBoolean in class java.io.ObjectInputStream
        Throws:
        java.io.IOException
      • readByte

        public final byte readByte()
                            throws java.io.IOException
        Specified by:
        readByte in interface java.io.DataInput
        Overrides:
        readByte in class java.io.ObjectInputStream
        Throws:
        java.io.IOException
      • readChar

        public final char readChar()
                            throws java.io.IOException
        Specified by:
        readChar in interface java.io.DataInput
        Overrides:
        readChar in class java.io.ObjectInputStream
        Throws:
        java.io.IOException
      • readDouble

        public final double readDouble()
                                throws java.io.IOException
        Specified by:
        readDouble in interface java.io.DataInput
        Overrides:
        readDouble in class java.io.ObjectInputStream
        Throws:
        java.io.IOException
      • readFloat

        public final float readFloat()
                              throws java.io.IOException
        Specified by:
        readFloat in interface java.io.DataInput
        Overrides:
        readFloat in class java.io.ObjectInputStream
        Throws:
        java.io.IOException
      • readFully

        public final void readFully​(byte[] data)
                             throws java.io.IOException
        Specified by:
        readFully in interface java.io.DataInput
        Overrides:
        readFully in class java.io.ObjectInputStream
        Throws:
        java.io.IOException
      • readFully

        public final void readFully​(byte[] data,
                                    int offset,
                                    int size)
                             throws java.io.IOException
        Specified by:
        readFully in interface java.io.DataInput
        Overrides:
        readFully in class java.io.ObjectInputStream
        Throws:
        java.io.IOException
      • readInt

        public final int readInt()
                          throws java.io.IOException
        Specified by:
        readInt in interface java.io.DataInput
        Overrides:
        readInt in class java.io.ObjectInputStream
        Throws:
        java.io.IOException
      • readLine

        public final java.lang.String readLine()
                                        throws java.io.IOException
        Specified by:
        readLine in interface java.io.DataInput
        Overrides:
        readLine in class java.io.ObjectInputStream
        Throws:
        java.io.IOException
      • readLong

        public final long readLong()
                            throws java.io.IOException
        Specified by:
        readLong in interface java.io.DataInput
        Overrides:
        readLong in class java.io.ObjectInputStream
        Throws:
        java.io.IOException
      • readShort

        public final short readShort()
                              throws java.io.IOException
        Specified by:
        readShort in interface java.io.DataInput
        Overrides:
        readShort in class java.io.ObjectInputStream
        Throws:
        java.io.IOException
      • readStreamHeader

        protected final void readStreamHeader()
                                       throws java.io.IOException,
                                              java.io.StreamCorruptedException
        Overrides:
        readStreamHeader in class java.io.ObjectInputStream
        Throws:
        java.io.IOException
        java.io.StreamCorruptedException
      • readUnsignedByte

        public final int readUnsignedByte()
                                   throws java.io.IOException
        Specified by:
        readUnsignedByte in interface java.io.DataInput
        Overrides:
        readUnsignedByte in class java.io.ObjectInputStream
        Throws:
        java.io.IOException
      • readUnsignedShort

        public final int readUnsignedShort()
                                    throws java.io.IOException
        Specified by:
        readUnsignedShort in interface java.io.DataInput
        Overrides:
        readUnsignedShort in class java.io.ObjectInputStream
        Throws:
        java.io.IOException
      • internalReadUTF

        protected java.lang.String internalReadUTF​(InputStream stream)
        Helper method for correcting the Kestrel bug 4367783 (dealing with larger than 8-bit chars). The old behavior was preserved in orbutil.IIOPInputStream_1_3 in order to interoperate with our legacy ORBs.
        Parameters:
        stream - Stream to read from
        Returns:
        String value read from the stream
      • readUTF

        public final java.lang.String readUTF()
                                       throws java.io.IOException
        Specified by:
        readUTF in interface java.io.DataInput
        Overrides:
        readUTF in class java.io.ObjectInputStream
        Throws:
        java.io.IOException
      • handleOptionalDataMarshalException

        private void handleOptionalDataMarshalException​(MARSHAL marshalException,
                                                        boolean objectRead)
                                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • registerValidation

        public final void registerValidation​(java.io.ObjectInputValidation obj,
                                             int prio)
        Overrides:
        registerValidation in class java.io.ObjectInputStream
      • resolveClass

        protected final java.lang.Class<?> resolveClass​(java.io.ObjectStreamClass v)
                                                 throws java.io.IOException
        Overrides:
        resolveClass in class java.io.ObjectInputStream
        Throws:
        java.io.IOException
      • resolveObject

        protected final java.lang.Object resolveObject​(java.lang.Object obj)
                                                throws java.io.IOException
        Overrides:
        resolveObject in class java.io.ObjectInputStream
        Throws:
        java.io.IOException
      • skipBytes

        public final int skipBytes​(int len)
                            throws java.io.IOException
        Specified by:
        skipBytes in interface java.io.DataInput
        Overrides:
        skipBytes in class java.io.ObjectInputStream
        Throws:
        java.io.IOException
      • handleEnum

        private java.lang.Object handleEnum​(java.lang.Class clz,
                                            ClassInfoCache.ClassInfo cinfo)
                                     throws java.io.IOException
        Throws:
        java.io.IOException
      • readingExternalizable

        @InfoMethod
        private void readingExternalizable()
      • readingSerializable

        @InfoMethod
        private void readingSerializable()
      • newInstanceInfo

        @InfoMethod
        private void newInstanceInfo​(java.lang.Class<?> cls)
      • readingDataForClass

        @InfoMethod
        private void readingDataForClass​(java.lang.Class<?> cls)
      • classHasWriteObject

        @InfoMethod
        private void classHasWriteObject​(boolean flag)
      • currentClassInfo

        @InfoMethod
        private void currentClassInfo​(ObjectStreamClass ocs,
                                      java.lang.Class<?> cls)
      • matchingClassInfo

        @InfoMethod
        private void matchingClassInfo​(java.lang.Class<?> cls)
      • callReadExternal

        private void callReadExternal​(java.io.Externalizable ext)
                               throws java.io.IOException,
                                      java.lang.ClassNotFoundException
        Throws:
        java.io.IOException
        java.lang.ClassNotFoundException
      • inputObject

        private java.lang.Object inputObject​(java.lang.Class clz,
                                             ClassInfoCache.ClassInfo cinfo,
                                             java.lang.String repositoryID,
                                             CodeBase sender,
                                             int offset)
                                      throws java.io.IOException,
                                             java.lang.ClassNotFoundException
        Throws:
        java.io.IOException
        java.lang.ClassNotFoundException
      • readDefaultWriteObjectCalledFlag

        private boolean readDefaultWriteObjectCalledFlag()
                                                  throws java.io.IOException
        Throws:
        java.io.IOException
      • isDateClassWorkaroundRequired

        private boolean isDateClassWorkaroundRequired()
      • getSimulatedDefaultWriteObjectCalledFlag

        private boolean getSimulatedDefaultWriteObjectCalledFlag()
      • isJdk9_orLater

        private boolean isJdk9_orLater()
      • fullValueDescriptorsInfo

        @InfoMethod
        private void fullValueDescriptorsInfo​(java.util.List<FullValueDescription> fvds)
      • getOrderedDescriptions

        private java.util.List<FullValueDescription> getOrderedDescriptions​(java.lang.String repositoryID,
                                                                            CodeBase sender)
      • inputObjectUsingFVD

        private java.lang.Object inputObjectUsingFVD​(java.lang.Class clz,
                                                     ClassInfoCache.ClassInfo cinfo,
                                                     java.lang.String repositoryID,
                                                     CodeBase sender,
                                                     int offset)
                                              throws java.io.IOException,
                                                     java.lang.ClassNotFoundException
        This input method uses FullValueDescriptions retrieved from the sender's runtime to read in the data. This method is capable of throwing out data not applicable to client's fields. This method handles instances where the reader has a class not sent by the sender, the sender sent a class not present on the reader, and/or the reader's class does not match the sender's class. NOTE : If the local description indicates custom marshaling and the remote type's FVD also indicates custom marsahling than the local type is used to read the data off the wire. However, if either says custom while the other does not, a MARSHAL error is thrown. Externalizable is a form of custom marshaling.
        Throws:
        java.io.IOException
        java.lang.ClassNotFoundException
      • skipObjectUsingFVD

        private java.lang.Object skipObjectUsingFVD​(java.lang.String repositoryID,
                                                    CodeBase sender)
                                             throws java.io.IOException,
                                                    java.lang.ClassNotFoundException
        This input method uses FullValueDescriptions retrieved from the sender's runtime to read in the data. This method is capable of throwing out data not applicable to client's fields. NOTE : If the local description indicates custom marshaling and the remote type's FVD also indicates custom marsahling than the local type is used to read the data off the wire. However, if either says custom while the other does not, a MARSHAL error is thrown. Externalizable is a form of custom marshaling.
        Throws:
        java.io.IOException
        java.lang.ClassNotFoundException
      • findNextClass

        private int findNextClass​(java.lang.String classname,
                                  java.lang.Class[] classes,
                                  int _spClass,
                                  int _spBase)
      • invokeObjectReader

        private boolean invokeObjectReader​(ObjectStreamClass osc,
                                           java.lang.Object obj,
                                           java.lang.Class aclass,
                                           ValueMember[] valueMembers)
                                    throws java.io.InvalidClassException,
                                           java.io.StreamCorruptedException,
                                           java.lang.ClassNotFoundException,
                                           java.io.IOException
        Throws:
        java.io.InvalidClassException
        java.io.StreamCorruptedException
        java.lang.ClassNotFoundException
        java.io.IOException
      • resetStream

        private void resetStream()
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • inputPrimitiveField

        private void inputPrimitiveField​(java.lang.Object o,
                                         java.lang.Class<?> cl,
                                         ObjectStreamField field)
                                  throws java.io.InvalidClassException,
                                         java.io.IOException
        Factored out of inputClassFields This reads a primitive value and sets it in the field of o described by the ObjectStreamField field. Note that reflection cannot be used here, because reflection cannot be used to set final fields.
        Throws:
        java.io.InvalidClassException
        java.io.IOException
      • callTypeInfo

        @InfoMethod
        private void callTypeInfo​(int ct)
      • typeInfo

        @InfoMethod
        private void typeInfo​(java.lang.Class<?> type)
      • inputObjectField

        private java.lang.Object inputObjectField​(ValueMember field,
                                                  CodeBase sender)
                                           throws IndirectionException,
                                                  java.lang.ClassNotFoundException,
                                                  java.io.IOException,
                                                  java.io.StreamCorruptedException
        Throws:
        IndirectionException
        java.lang.ClassNotFoundException
        java.io.IOException
        java.io.StreamCorruptedException
      • inputObjectField

        private java.lang.Object inputObjectField​(ObjectStreamField field)
                                           throws java.io.InvalidClassException,
                                                  java.io.StreamCorruptedException,
                                                  java.lang.ClassNotFoundException,
                                                  IndirectionException,
                                                  java.io.IOException
        Factored out of inputClassFields and reused in inputCurrentClassFieldsForReadFields. Reads the field (which is of an Object type as opposed to a primitive) described by ObjectStreamField field and returns it.
        Throws:
        java.io.InvalidClassException
        java.io.StreamCorruptedException
        java.lang.ClassNotFoundException
        IndirectionException
        java.io.IOException
      • readFields

        void readFields​(java.util.Map<java.lang.String,​java.lang.Object> fieldToValueMap)
                 throws java.io.InvalidClassException,
                        java.io.StreamCorruptedException,
                        java.lang.ClassNotFoundException,
                        java.io.IOException
        Specified by:
        readFields in class InputStreamHook
        Throws:
        java.io.InvalidClassException
        java.io.StreamCorruptedException
        java.lang.ClassNotFoundException
        java.io.IOException
      • inputRemoteMembersForReadFields

        private void inputRemoteMembersForReadFields​(java.util.Map<java.lang.String,​java.lang.Object> fieldToValueMap)
                                              throws java.io.InvalidClassException,
                                                     java.io.StreamCorruptedException,
                                                     java.lang.ClassNotFoundException,
                                                     java.io.IOException
        Throws:
        java.io.InvalidClassException
        java.io.StreamCorruptedException
        java.lang.ClassNotFoundException
        java.io.IOException
      • inputCurrentClassFieldsForReadFields

        private void inputCurrentClassFieldsForReadFields​(java.util.Map<java.lang.String,​java.lang.Object> fieldToValueMap)
                                                   throws java.io.InvalidClassException,
                                                          java.io.StreamCorruptedException,
                                                          java.lang.ClassNotFoundException,
                                                          java.io.IOException
        Called from InputStreamHook. Reads the fields of the current class (could be the ones queried from the remote FVD) and puts them in the given Map, name to value. Wraps primitives in the corresponding java.lang Objects.
        Throws:
        java.io.InvalidClassException
        java.io.StreamCorruptedException
        java.lang.ClassNotFoundException
        java.io.IOException
      • readingPrimitiveFields

        @InfoMethod
        private void readingPrimitiveFields​(int count)
      • readingField

        @InfoMethod
        private void readingField​(int index,
                                  ObjectStreamField fld)
      • inputClassFields

        private void inputClassFields​(java.lang.Object o,
                                      java.lang.Class<?> cl,
                                      ObjectStreamField[] fields,
                                      CodeBase sender)
                               throws java.io.InvalidClassException,
                                      java.io.StreamCorruptedException,
                                      java.lang.ClassNotFoundException,
                                      java.io.IOException
        Throws:
        java.io.InvalidClassException
        java.io.StreamCorruptedException
        java.lang.ClassNotFoundException
        java.io.IOException
      • valueMemberInfo

        @InfoMethod
        private void valueMemberInfo​(java.lang.String name,
                                     java.lang.String id,
                                     java.lang.String definedIn,
                                     java.lang.String version,
                                     short access)
      • displayValueMember

        private void displayValueMember​(ValueMember member)
      • displayValueMembers

        private void displayValueMembers​(ValueMember[] members)
      • inputClassFields

        private void inputClassFields​(java.lang.Object o,
                                      java.lang.Class<?> cl,
                                      ObjectStreamClass osc,
                                      ValueMember[] fields,
                                      CodeBase sender)
                               throws java.io.InvalidClassException,
                                      java.io.StreamCorruptedException,
                                      java.lang.ClassNotFoundException,
                                      java.io.IOException
        Throws:
        java.io.InvalidClassException
        java.io.StreamCorruptedException
        java.lang.ClassNotFoundException
        java.io.IOException
      • skipCustomUsingFVD

        private void skipCustomUsingFVD​(ValueMember[] fields,
                                        CodeBase sender)
                                 throws java.io.InvalidClassException,
                                        java.io.StreamCorruptedException,
                                        java.lang.ClassNotFoundException,
                                        java.io.IOException
        Throws:
        java.io.InvalidClassException
        java.io.StreamCorruptedException
        java.lang.ClassNotFoundException
        java.io.IOException
      • throwAwayData

        private void throwAwayData​(ValueMember[] fields,
                                   CodeBase sender)
                            throws java.io.InvalidClassException,
                                   java.io.StreamCorruptedException,
                                   java.lang.ClassNotFoundException,
                                   java.io.IOException
        Throws:
        java.io.InvalidClassException
        java.io.StreamCorruptedException
        java.lang.ClassNotFoundException
        java.io.IOException
      • setObjectField

        private static void setObjectField​(java.lang.Object o,
                                           java.lang.Class<?> c,
                                           java.lang.String fieldName,
                                           java.lang.Object v)
      • setBooleanField

        private static void setBooleanField​(java.lang.Object o,
                                            java.lang.Class<?> c,
                                            java.lang.String fieldName,
                                            boolean v)
      • setByteField

        private static void setByteField​(java.lang.Object o,
                                         java.lang.Class<?> c,
                                         java.lang.String fieldName,
                                         byte v)
      • setCharField

        private static void setCharField​(java.lang.Object o,
                                         java.lang.Class<?> c,
                                         java.lang.String fieldName,
                                         char v)
      • setShortField

        private static void setShortField​(java.lang.Object o,
                                          java.lang.Class<?> c,
                                          java.lang.String fieldName,
                                          short v)
      • setIntField

        private static void setIntField​(java.lang.Object o,
                                        java.lang.Class<?> c,
                                        java.lang.String fieldName,
                                        int v)
      • setLongField

        private static void setLongField​(java.lang.Object o,
                                         java.lang.Class<?> c,
                                         java.lang.String fieldName,
                                         long v)
      • setFloatField

        private static void setFloatField​(java.lang.Object o,
                                          java.lang.Class<?> c,
                                          java.lang.String fieldName,
                                          float v)
      • setDoubleField

        private static void setDoubleField​(java.lang.Object o,
                                           java.lang.Class<?> c,
                                           java.lang.String fieldName,
                                           double v)