Interface NetworkBuffer
-
- All Known Implementing Classes:
FileRegionBuffer,NettyBuffer,NioBuffer
public interface NetworkBufferThis 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 Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description byte[]copyToByteArray()Copy to a new byte[]intlength()Number of bytes of the data.io.netty.buffer.ByteBufnettyByteBuf()Convert the buffer into an ByteBuf object, used to write the data out.java.nio.ByteBuffernioByteBuffer()Exposes this buffer's data as an NIO ByteBuffer.intreferenceCount()Returns the reference count.NetworkBufferrelease()If applicable, decrease the reference count by one and deallocates the buffer if the reference count reaches zero.NetworkBufferretain()Increase the reference count by one if applicable.
-
-
-
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[]
-
-