|
||||||||||
| 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 ProtocolParser#startBuffer() ?
This method is typically called after processing the protocol message,
to determine if the ByteBuffer has more bytes which
need to parsed into a next 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 hasNextMessage() 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 ProtocolParser#startBuffer(). |
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()
hasNextMessage() to determine if the
ByteBuffer which has been parsed contains a partial message
boolean hasMoreBytesToParse()
ByteBuffer given
to this ProtocolParser's ProtocolParser#startBuffer() ?
This method is typically called after processing the protocol message,
to determine if the ByteBuffer has more bytes which
need to parsed into a next message.
T getNextMessage()
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()
ProtocolParser#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 | |||||||||