Class BufferedData


  • public class BufferedData
    extends ExpandableBuffer
    A buffer that expand its capacity on demand. Internally, this class is backed by an instance of ByteBuffer.

    This class is not thread safe.

    Since:
    5.0
    • Constructor Detail

      • BufferedData

        protected BufferedData​(int bufferSize)
    • Method Detail

      • allocate

        public static BufferedData allocate​(int bufferSize)
      • hasData

        public final boolean hasData()
        Description copied from class: ExpandableBuffer
        Determines if the buffer contains data.

        Sets the mode to output.

        Overrides:
        hasData in class ExpandableBuffer
        Returns:
        true if there is data in the buffer, false otherwise.
      • length

        public final int length()
        Description copied from class: ExpandableBuffer
        Returns the length of this buffer.

        Sets the mode to output.

        Overrides:
        length in class ExpandableBuffer
        Returns:
        buffer length.
      • capacity

        public final int capacity()
        Description copied from class: ExpandableBuffer
        Returns available capacity of this buffer.
        Overrides:
        capacity in class ExpandableBuffer
        Returns:
        buffer length.
      • put

        public final void put​(java.nio.ByteBuffer src)
      • readFrom

        public final int readFrom​(java.nio.channels.ReadableByteChannel channel)
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • writeTo

        public final int writeTo​(java.nio.channels.WritableByteChannel dst)
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • data

        public final java.nio.ByteBuffer data()