Interface NetworkBuffer

  • All Known Implementing Classes:
    FileRegionBuffer, NettyBuffer, NioBuffer

    public interface NetworkBuffer
    This interface provides an immutable view for data in the form of bytes with reference counting. The implementation should specify how the data is provided: - NioBuffer: data backed by a NIO ByteBuffer - NettyBuffer: data backed by a Netty ByteBuf - FileRegionBuffer: data backed by a File Region
    • Method Detail

      • length

        int length()
        Number of bytes of the data.
      • retain

        NetworkBuffer retain()
        Increase the reference count by one if applicable.
      • release

        NetworkBuffer release()
        If applicable, decrease the reference count by one and deallocates the buffer if the reference count reaches zero.
      • referenceCount

        int referenceCount()
        Returns the reference count.
      • nioByteBuffer

        java.nio.ByteBuffer nioByteBuffer()
        Exposes this buffer's data as an NIO ByteBuffer. Changing the position and limit of the returned ByteBuffer should not affect the content of this buffer.
      • nettyByteBuf

        io.netty.buffer.ByteBuf nettyByteBuf()
        Convert the buffer into an ByteBuf object, used to write the data out.
      • copyToByteArray

        byte[] copyToByteArray()
        Copy to a new byte[]