Package org.drasyl.handler.connection
Class ReceiveBuffer
java.lang.Object
org.drasyl.handler.connection.ReceiveBuffer
Represents the receive buffer that holds incoming data received over a connection.
The receive buffer is used by the receiver to hold incoming data that has been successfully received from the sender. The buffer allows the receiver to temporarily store the received data until it can be processed by the receiving application.
-
Method Summary
Modifier and TypeMethodDescriptionint
bytes()
The number of readable bytes.void
fireRead
(io.netty.channel.ChannelHandlerContext ctx, TransmissionControlBlock tcb) Passes, if any, readable bytes that this buffer contains to the receiving application.boolean
Returnstrue
if this buffer contains at least one byte ready to pass to the receiving application.int
Returns the amount of bytes that this buffer can pass to the receiving application.void
receive
(io.netty.channel.ChannelHandlerContext ctx, TransmissionControlBlock tcb, Segment seg) void
release()
Release all buffers in the queue and complete all listeners and promises.int
size()
toString()
-
Method Details
-
release
public void release()Release all buffers in the queue and complete all listeners and promises. -
bytes
public int bytes()The number of readable bytes. -
size
public int size() -
toString
-
receive
public void receive(io.netty.channel.ChannelHandlerContext ctx, TransmissionControlBlock tcb, Segment seg) -
fireRead
Passes, if any, readable bytes that this buffer contains to the receiving application.- Parameters:
ctx
- theConnectionHandler
's contexttcb
- the transmission control block this
-
readableBytes
public int readableBytes()Returns the amount of bytes that this buffer can pass to the receiving application.- Returns:
- the amount of bytes that this buffer can pass to the receiving application
-
isReadable
public boolean isReadable()Returnstrue
if this buffer contains at least one byte ready to pass to the receiving application.- Returns:
true
if this buffer contains at least one byte ready to pass to the receiving application
-