|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ProtocolParser<T>
An interface that knows how to parse bytes into a protocol data unit.
Field Summary | |
---|---|
static String |
MESSAGE
Holds the message returned from getNextMessage for
use by downstream filters |
static String |
PARSER
Used to associate a particular parser with a connection |
Method Summary | |
---|---|
T |
getNextMessage()
Get the next complete message from the buffer, which can then be processed by the next filter in the protocol chain. |
boolean |
hasMoreBytesToParse()
Are there more bytes to be parsed in the ByteBuffer given
to this ProtocolParser's setBuffer ?
This method is typically called after a call to parseBytes()
to determine if the ByteBuffer has more bytes which need to
parsed into a message. |
boolean |
hasNextMessage()
Indicates whether the buffer has a complete message that can be returned from getNextMessage . |
boolean |
isExpectingMoreData()
Is this ProtocolParser expecting more data ? This method is typically called after a call to parseBytes()
to determine if the ByteBuffer which has been parsed
contains a partial message |
boolean |
releaseBuffer()
No more parsing will be done on the buffer passed to startBuffer.
Set up the buffer so that its position is the first byte that was
not part of a full message, and its limit is the original limit of
the buffer. |
void |
startBuffer(ByteBuffer bb)
Set the buffer to be parsed. |
Field Detail |
---|
static final String PARSER
static final String MESSAGE
getNextMessage
for
use by downstream filters
Method Detail |
---|
boolean isExpectingMoreData()
parseBytes()
to determine if the ByteBuffer
which has been parsed
contains a partial message
true
if more bytes are needed to construct a
message; false
, if no
additional bytes remain to be parsed into a T
.
Note that if no partial message exists, this method should
return false.boolean hasMoreBytesToParse()
ByteBuffer
given
to this ProtocolParser's setBuffer
?
This method is typically called after a call to parseBytes()
to determine if the ByteBuffer
has more bytes which need to
parsed into a message.
true
if there are more bytes to be parsed.
Otherwise false
.T getNextMessage()
null.
boolean hasNextMessage()
getNextMessage
. Smart implementations of
this will set up all the information so that an actual call to
getNextMessage
doesn't need to re-parse the data.
void startBuffer(ByteBuffer bb)
getNextMessage
will return distinct messages, and the buffer can be restored after
parsing when the releaseBuffer
method is called.
boolean releaseBuffer()
startBuffer.
Set up the buffer so that its position is the first byte that was
not part of a full message, and its limit is the original limit of
the buffer.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |