Class MessageReader

java.lang.Object
org.jgroups.nio.MessageReader

public class MessageReader extends Object
Class for reading length prefix messages from a channel. We have an internal buffer which is compacted and grown as needed. We have a separate reader index, and buffer.position() is used as the writer index; this is similar to Netty ByteBuf. The limit is not used and always same as capacity.
Since:
5.5.3
Author:
Christian Fredriksson
  • Field Details

    • max_length

      protected int max_length
    • conn

      protected final NioConnection conn
  • Constructor Details

  • Method Details

    • readMessage

      public ByteBuffer readMessage() throws IOException
      Reads length prefixed messages from a channel.
      Returns:
      The buffer (position is 0 and limit is length), or null if not all data could be read.
      Throws:
      IOException
    • maxLength

      public MessageReader maxLength(int max_length)
    • toString

      public String toString()
      Overrides:
      toString in class Object