Interface DataBuffer

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      long getLength()
      Returns the length of the data.
      java.lang.Object getNettyOutput()
      Returns an object for writing to a netty channel.
      java.nio.ByteBuffer getReadOnlyByteBuffer()
      Returns a ByteBuffer for read-only access to the data.
      int readableBytes()  
      void readBytes​(byte[] dst, int dstIndex, int length)
      Transfers this buffer's data to the specified destination starting at the current readerIndex and increases the readerIndex by the number of the transferred bytes (= length).
      void readBytes​(java.io.OutputStream outputStream, int length)
      Transfers this buffer's data to the given stream.
      void readBytes​(java.nio.ByteBuffer outputBuf)
      Transfers this buffer's data to the given ByteBuffer.
      void release()
      Releases the underlying buffer of this DataBuffer if no longer needed.
    • Method Detail

      • getNettyOutput

        java.lang.Object getNettyOutput()
        Returns an object for writing to a netty channel.
        Returns:
        the object to output to Netty. Must be ByteBuf or FileRegion
      • getLength

        long getLength()
        Returns the length of the data.
        Returns:
        the length of the data in bytes
      • getReadOnlyByteBuffer

        java.nio.ByteBuffer getReadOnlyByteBuffer()
        Returns a ByteBuffer for read-only access to the data.
        Returns:
        a read-only ByteBuffer representing the data
      • readBytes

        void readBytes​(byte[] dst,
                       int dstIndex,
                       int length)
        Transfers this buffer's data to the specified destination starting at the current readerIndex and increases the readerIndex by the number of the transferred bytes (= length).
        Parameters:
        dst - the destination
        dstIndex - the first index of the destination
        length - the number of bytes to transfer
      • readBytes

        void readBytes​(java.io.OutputStream outputStream,
                       int length)
                throws java.io.IOException
        Transfers this buffer's data to the given stream.
        Parameters:
        outputStream - the stream to transfer data to
        length - length of the data to be transferred
        Throws:
        java.io.IOException
      • readBytes

        void readBytes​(java.nio.ByteBuffer outputBuf)
        Transfers this buffer's data to the given ByteBuffer.
        Parameters:
        outputBuf - the buffer to transfer data to
      • readableBytes

        int readableBytes()
        Returns:
        the number of readable bytes remaining
      • release

        void release()
        Releases the underlying buffer of this DataBuffer if no longer needed.