Class ByteBufferInput

  • All Implemented Interfaces:
    Pool.Poolable, Closeable, AutoCloseable
    Direct Known Subclasses:
    UnsafeByteBufferInput

    public class ByteBufferInput
    extends Input
    An Input that uses a ByteBuffer rather than a byte[].

    Note that the byte[] buffer is not used. Code taking an Input and expecting the byte[] to be used may not work correctly.

    Author:
    Roman Levenstein , Nathan Sweet
    • Constructor Detail

      • ByteBufferInput

        public ByteBufferInput()
        Creates an uninitialized Input, setBuffer(ByteBuffer) must be called before the Input is used.
      • ByteBufferInput

        public ByteBufferInput​(int bufferSize)
        Creates a new Input for reading from a direct ByteBuffer.
        Parameters:
        bufferSize - The size of the buffer. An exception is thrown if more bytes than this are read and fill(ByteBuffer, int, int) does not supply more bytes.
      • ByteBufferInput

        public ByteBufferInput​(byte[] bytes)
        Creates a new Input for reading from a ByteBuffer which is filled with the specified bytes.
      • ByteBufferInput

        public ByteBufferInput​(byte[] bytes,
                               int offset,
                               int count)
        Creates a new Input for reading from a ByteBuffer which is filled with the specified bytes.
        See Also:
        setBuffer(byte[], int, int)
      • ByteBufferInput

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