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
限定符 | 构造器和说明 |
---|---|
protected |
AbstractMessageDecoder(int type) |
限定符和类型 | 方法和说明 |
---|---|
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.
|
protected abstract AbstractMessage |
decodeBody(IoSession session,
IoBuffer in) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
finishDecode
public MessageDecoderResult decodable(IoSession session, IoBuffer in)
MessageDecoder
decodable
在接口中 MessageDecoder
session
- The current sessionin
- The buffer containing the data to decodeMessageDecoder.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(IoSession session, IoBuffer in, ProtocolDecoderOutput out) throws java.lang.Exception
MessageDecoder
MessageDecoder.decode(IoSession, IoBuffer, ProtocolDecoderOutput)
method with read data, and then the decoder implementation puts decoded
messages into ProtocolDecoderOutput
.decode
在接口中 MessageDecoder
session
- The current sessionin
- The buffer containing the data to decodeout
- The instance of ProtocolDecoderOutput
that will receive the decoded messagesMessageDecoder.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.java.lang.Exception
- if the read data violated protocol specificationprotected abstract AbstractMessage decodeBody(IoSession session, IoBuffer in)
session
- The current sessionin
- The incoming buffer