Class MessageReader
java.lang.Object
org.jgroups.nio.MessageReader
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 Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMessageReader(SocketChannel channel) MessageReader(NioConnection c, SocketChannel channel) MessageReader(NioConnection c, SocketChannel channel, int initial_buf_size, boolean use_direct_buffers) -
Method Summary
-
Field Details
-
max_length
protected int max_length -
conn
-
-
Constructor Details
-
MessageReader
-
MessageReader
-
MessageReader
public MessageReader(NioConnection c, SocketChannel channel, int initial_buf_size, boolean use_direct_buffers)
-
-
Method Details
-
readMessage
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
-
toString
-