Class ByteBufferInput

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    public class ByteBufferInput
    extends Input
    An InputStream that reads data from a byte array and optionally fills the byte array from another InputStream as needed. Utility methods are provided for efficiently reading primitive types and strings.
    Author:
    Roman Levenstein
    • Field Detail

      • varIntsEnabled

        protected boolean varIntsEnabled
      • nativeOrder

        protected static final ByteOrder nativeOrder
    • Constructor Detail

      • ByteBufferInput

        public ByteBufferInput()
        Creates an uninitialized Input. A buffer must be set before the Input is used.
        See Also:
        setBuffer(ByteBuffer)
      • ByteBufferInput

        public ByteBufferInput​(int bufferSize)
        Creates a new Input for reading from a byte array.
        Parameters:
        bufferSize - The size of the buffer. An exception is thrown if more bytes than this are read.
      • ByteBufferInput

        public ByteBufferInput​(byte[] buffer)
      • ByteBufferInput

        public ByteBufferInput​(ByteBuffer buffer)
        Creates a new Input for reading from a ByteBuffer.
      • ByteBufferInput

        public ByteBufferInput​(InputStream inputStream)
        Creates a new Input for reading from an InputStream with a buffer size of 4096.
      • ByteBufferInput

        public ByteBufferInput​(InputStream inputStream,
                               int bufferSize)
        Creates a new Input for reading from an InputStream.