public interface Message
An interface that represents a message read from/written into channels. It should know how to read/write itself from/into the channel.
Please use instanceof operator to determine the type of the
message.
boolean read(java.nio.ByteBuffer buffer)
throws MessageParseException
position will be 0 and
limit will be the number of bytes read.true if the message is read fully.
false if the buffer is exhausted and more bytes
are left to read, or if more bytes are required to complete the
message.MessageParseException - if the bytes in the buffer is not understandable.boolean write(java.nio.ByteBuffer buffer)
true. the position will be 0
and limit will be the same as capacity.true if the message is written fully.
false if the buffer is full and more bytes are
left to write, or the message wants to write the remainder at
next invocation.Copyright © 2004-2012 Trustin Lee. All Rights Reserved.