Class WrapperBufferInput

    • Constructor Detail

      • WrapperBufferInput

        public WrapperBufferInput​(DataInput in)
        Construct a WrapperBufferInput that will read from the specified object implementing the DataInput interface.
        Parameters:
        in - an object implementing DataInput to read from
      • WrapperBufferInput

        public WrapperBufferInput​(DataInput in,
                                  ClassLoader loader)
        Construct a WrapperBufferInput that will read from the specified object implementing the DataInput interface.
        Parameters:
        in - an object implementing DataInput to read from
        loader - the ClassLoader to use
    • Method Detail

      • getBuffer

        public ReadBuffer getBuffer()
        Get the ReadBuffer object that this BufferInput is reading from.
        Specified by:
        getBuffer in interface ReadBuffer.BufferInput
        Returns:
        the underlying ReadBuffer object
      • readSafeUTF

        public String readSafeUTF()
                           throws IOException
        Read a variable-length encoded UTF packed String. The major differences between this implementation and DataInput is that this supports null String values and is not limited to 64KB UTF-encoded values.
        Specified by:
        readSafeUTF in interface ReadBuffer.BufferInput
        Returns:
        a String value; may be null
        Throws:
        IOException - if an I/O error occurs
      • readBuffer

        public ReadBuffer readBuffer​(int cb)
                              throws IOException
        Read cb bytes and return them as a ReadBuffer object.
        Specified by:
        readBuffer in interface ReadBuffer.BufferInput
        Parameters:
        cb - the number of bytes to read
        Returns:
        a ReadBuffer object composed of cb bytes read from the BufferInput
        Throws:
        EOFException - if the stream is exhausted before the number of bytes indicated could be read
        IOException - if an I/O error occurs
      • getOffset

        public int getOffset()
        Determine the current offset of this BufferInput within the underlying ReadBuffer.
        Specified by:
        getOffset in interface ReadBuffer.BufferInput
        Returns:
        the offset of the next byte to read from the ReadBuffer
      • setOffset

        public void setOffset​(int of)
        Specify the offset of the next byte to read from the underlying ReadBuffer.
        Specified by:
        setOffset in interface ReadBuffer.BufferInput
        Parameters:
        of - the offset of the next byte to read from the ReadBuffer
      • getObjectInputFilter

        public Object getObjectInputFilter()
        Description copied from interface: ReadBuffer.BufferInput
        Returns an ObjectInputFilter (or null) that should be used by the caller to confirm / deny deserialization of a class encoded in this input stream.

        Note: the return type is agnostic of the ObjectInputFilter to support various JDK versions.

        Specified by:
        getObjectInputFilter in interface ReadBuffer.BufferInput
        Returns:
        null or an ObjectInputFilter that will permit (or not) the constructor of a class encoded in this stream.
        See Also:
        ReadBuffer.BufferInput.setObjectInputFilter(Object)
      • setObjectInputFilter

        public void setObjectInputFilter​(Object filter)
        Description copied from interface: ReadBuffer.BufferInput
        Set the ObjectInputFilter for this stream.

        The filter's checkInput method is expected to be called for each class and reference deserialized in the stream.

        Specified by:
        setObjectInputFilter in interface ReadBuffer.BufferInput
        Parameters:
        filter - an ObjectInputFilter instance as an Object to enable running with Java version 8 or higher, may be null
      • getDataInput

        public DataInput getDataInput()
        Obtain the underlying object providing the DataInput interface that this object is delegating to.
        Overrides:
        getDataInput in class WrapperDataInputStream
        Returns:
        the underlying DataInput