Class ByteBufferImpl

  • All Implemented Interfaces:
    ByteBuffer
    Direct Known Subclasses:
    ByteBufferImpl

    public class ByteBufferImpl
    extends java.lang.Object
    implements ByteBuffer
    A byte buffer that exposes the internal byte array with minimal copying
    Since:
    4.0
    Author:
    (various)
    • Constructor Detail

      • ByteBufferImpl

        public ByteBufferImpl​(byte[] buf)
      • ByteBufferImpl

        public ByteBufferImpl​(byte[] buf,
                              int offset,
                              int length)
    • Method Detail

      • getBuf

        public byte[] getBuf()
        Description copied from interface: ByteBuffer
        Returns the underlying buffer.
        Specified by:
        getBuf in interface ByteBuffer
      • getOffset

        public int getOffset()
        Description copied from interface: ByteBuffer
        Returns the offset within the underlying byte[] (as returned by ByteBuffer.getBuf() owned by this buffer instance.
        Specified by:
        getOffset in interface ByteBuffer
      • getLength

        public int getLength()
        Description copied from interface: ByteBuffer
        Length bytes, starting from offset, within the underlying byte[] (as returned by ByteBuffer.getBuf() are owned by this buffer instance.
        Specified by:
        getLength in interface ByteBuffer
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • getStream

        public java.io.InputStream getStream()
        Returns:
        an input stream for the bytes in the buffer
      • toJDKByteBuffer

        public java.nio.ByteBuffer toJDKByteBuffer()