public abstract class AbstractMessageDecoder extends java.lang.Object implements MessageDecoder
MessageDecoder
that decodes message header and forwards
the decoding of body to a subclass.NEED_DATA, NOT_OK, OK
Modifier | Constructor and Description |
---|---|
protected |
AbstractMessageDecoder(int type) |
Modifier and Type | Method and Description |
---|---|
MessageDecoderResult |
decodable(ProtocolSession session,
ByteBuffer in)
Checks the specified buffer is decodable by this decoder.
|
MessageDecoderResult |
decode(ProtocolSession session,
ByteBuffer in,
ProtocolDecoderOutput out)
Decodes binary or protocol-specific content into higher-level message objects.
|
protected abstract AbstractMessage |
decodeBody(ProtocolSession session,
ByteBuffer in) |
public MessageDecoderResult decodable(ProtocolSession session, ByteBuffer in)
MessageDecoder
decodable
in interface MessageDecoder
MessageDecoder.OK
if this decoder can decode the specified buffer.
MessageDecoder.NOT_OK
if this decoder cannot decode the specified buffer.
MessageDecoder.NEED_DATA
if more data is required to determine if the
specified buffer is decodable (MessageDecoder.OK
) or not decodable
MessageDecoder.NOT_OK
.public MessageDecoderResult decode(ProtocolSession session, ByteBuffer in, ProtocolDecoderOutput out) throws ProtocolViolationException
MessageDecoder
MessageDecoder.decode(ProtocolSession, ByteBuffer, ProtocolDecoderOutput)
method with read data, and then the decoder implementation puts decoded
messages into ProtocolDecoderOutput
.decode
in interface MessageDecoder
MessageDecoder.OK
if you finished decoding messages successfully.
MessageDecoder.NEED_DATA
if you need more data to finish decoding current message.
MessageDecoder.NOT_OK
if you cannot decode current message due to protocol specification violation.ProtocolViolationException
- if the read data violated protocol
specificationprotected abstract AbstractMessage decodeBody(ProtocolSession session, ByteBuffer in)