Class ReceiveBuffer

java.lang.Object
org.drasyl.handler.connection.ReceiveBuffer

public class ReceiveBuffer extends Object
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 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

      public String toString()
      Overrides:
      toString in class Object
    • receive

      public void receive(io.netty.channel.ChannelHandlerContext ctx, TransmissionControlBlock tcb, Segment seg)
    • fireRead

      public void fireRead(io.netty.channel.ChannelHandlerContext ctx, TransmissionControlBlock tcb)
      Passes, if any, readable bytes that this buffer contains to the receiving application.
      Parameters:
      ctx - the ConnectionHandler's context
      tcb - 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()
      Returns true 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