public interface MessageDecoder
We didn't provide any dispose method for MessageDecoder
because it can give you performance penalty in case you have a lot of
message types to handle.
DemuxingProtocolDecoder,
MessageDecoderFactory| Modifier and Type | Field and Description |
|---|---|
static MessageDecoderResult |
NEED_DATA
Represents a result from
decodable(IoSession, IoBuffer) and
decode(IoSession, IoBuffer, ProtocolDecoderOutput). |
static MessageDecoderResult |
NOT_OK
Represents a result from
decodable(IoSession, IoBuffer) and
decode(IoSession, IoBuffer, ProtocolDecoderOutput). |
static MessageDecoderResult |
OK
Represents a result from
decodable(IoSession, IoBuffer) and
decode(IoSession, IoBuffer, ProtocolDecoderOutput). |
| Modifier and Type | Method and Description |
|---|---|
MessageDecoderResult |
decodable(IoSession session,
IoBuffer in)
Checks the specified buffer is decodable by this decoder.
|
MessageDecoderResult |
decode(IoSession session,
IoBuffer in,
ProtocolDecoderOutput out)
Decodes binary or protocol-specific content into higher-level message objects.
|
void |
finishDecode(IoSession session,
ProtocolDecoderOutput out)
Invoked when the specified session is closed while this decoder was
parsing the data.
|
static final MessageDecoderResult OK
decodable(IoSession, IoBuffer) and
decode(IoSession, IoBuffer, ProtocolDecoderOutput). Please
refer to each method's documentation for detailed explanation.static final MessageDecoderResult NEED_DATA
decodable(IoSession, IoBuffer) and
decode(IoSession, IoBuffer, ProtocolDecoderOutput). Please
refer to each method's documentation for detailed explanation.static final MessageDecoderResult NOT_OK
decodable(IoSession, IoBuffer) and
decode(IoSession, IoBuffer, ProtocolDecoderOutput). Please
refer to each method's documentation for detailed explanation.MessageDecoderResult decodable(IoSession session, IoBuffer in)
session - The current sessionin - The buffer containing the data to decodeOK if this decoder can decode the specified buffer.
NOT_OK if this decoder cannot decode the specified buffer.
NEED_DATA if more data is required to determine if the
specified buffer is decodable (OK) or not decodable
NOT_OK.MessageDecoderResult decode(IoSession session, IoBuffer in, ProtocolDecoderOutput out) throws Exception
decode(IoSession, IoBuffer, ProtocolDecoderOutput)
method with read data, and then the decoder implementation puts decoded
messages into ProtocolDecoderOutput.session - The current sessionin - The buffer containing the data to decodeout - The instance of ProtocolDecoderOutput that will receive the decoded messagesOK if you finished decoding messages successfully.
NEED_DATA if you need more data to finish decoding current message.
NOT_OK if you cannot decode current message due to protocol specification violation.Exception - if the read data violated protocol specificationvoid finishDecode(IoSession session, ProtocolDecoderOutput out) throws Exception
decode(IoSession, IoBuffer, ProtocolDecoderOutput) method didn't process
completely.session - The current sessionout - The instance of ProtocolDecoderOutput that contains the decoded messagesException - if the read data violated protocol specificationCopyright © 2004–2017 Apache MINA Project. All rights reserved.