Class AbstractObjectInput

    • Constructor Detail

      • AbstractObjectInput

        protected AbstractObjectInput​(int bufferSize)
        Construct a new instance.
        Parameters:
        bufferSize - the buffer size to use
    • Method Detail

      • readObject

        public final java.lang.Object readObject()
                                          throws java.lang.ClassNotFoundException,
                                                 java.io.IOException
        Specified by:
        readObject in interface java.io.ObjectInput
        Throws:
        java.lang.ClassNotFoundException
        java.io.IOException
      • readObjectUnshared

        public final java.lang.Object readObjectUnshared()
                                                  throws java.lang.ClassNotFoundException,
                                                         java.io.IOException
        Read and return an unshared object.
        Returns:
        an unshared object
        Throws:
        java.lang.ClassNotFoundException - if the class of a serialized object cannot be found
        java.io.IOException - if an error occurs
      • doReadObject

        protected abstract java.lang.Object doReadObject​(boolean unshared)
                                                  throws java.lang.ClassNotFoundException,
                                                         java.io.IOException
        Implementation of the actual object-reading method.
        Parameters:
        unshared - true if the instance should be unshared, false if it is shared
        Returns:
        the object to read
        Throws:
        java.lang.ClassNotFoundException - if the class for the object could not be loaded
        java.io.IOException - if an I/O error occurs
      • readObject

        public <T> T readObject​(java.lang.Class<T> type)
                         throws java.lang.ClassNotFoundException,
                                java.io.IOException
        Read and return an object, cast to a specific type.
        Type Parameters:
        T - the object type
        Parameters:
        type - the object class
        Returns:
        the object read from the stream
        Throws:
        java.lang.ClassNotFoundException - if the class of a serialized object cannot be found
        java.io.InvalidObjectException - if the object is not of the expected type
        java.io.IOException - if an error occurs
      • readObjectUnshared

        public <T> T readObjectUnshared​(java.lang.Class<T> type)
                                 throws java.lang.ClassNotFoundException,
                                        java.io.IOException
        Read and return an unshared object, cast to a specific type.
        Type Parameters:
        T - the object type
        Parameters:
        type - the object class
        Returns:
        an unshared object
        Throws:
        java.lang.ClassNotFoundException - if the class of a serialized object cannot be found
        java.io.InvalidObjectException - if the object is not of the expected type
        java.io.IOException - if an error occurs
      • wrongType

        private static java.io.InvalidObjectException wrongType​(java.lang.ClassCastException e,
                                                                java.lang.Class<?> expected,
                                                                java.lang.Class<?> actual)