Interface MessageDecoder
- All Known Implementing Classes:
MessageDecoderAdapter
public interface MessageDecoder
Decodes specific messages.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final MessageDecoderResult
Represents a result fromdecodable(IoSession, ByteBuffer)
anddecode(IoSession, ByteBuffer, ProtocolDecoderOutput)
.static final MessageDecoderResult
Represents a result fromdecodable(IoSession, ByteBuffer)
anddecode(IoSession, ByteBuffer, ProtocolDecoderOutput)
.static final MessageDecoderResult
Represents a result fromdecodable(IoSession, ByteBuffer)
anddecode(IoSession, ByteBuffer, ProtocolDecoderOutput)
. -
Method Summary
Modifier and TypeMethodDescriptiondecodable
(IoSession session, ByteBuffer in) Checks the specified buffer is decodable by this decoder.decode
(IoSession session, ByteBuffer 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.
-
Field Details
-
OK
Represents a result fromdecodable(IoSession, ByteBuffer)
anddecode(IoSession, ByteBuffer, ProtocolDecoderOutput)
. Please refer to each method's documentation for detailed explanation. -
NEED_DATA
Represents a result fromdecodable(IoSession, ByteBuffer)
anddecode(IoSession, ByteBuffer, ProtocolDecoderOutput)
. Please refer to each method's documentation for detailed explanation. -
NOT_OK
Represents a result fromdecodable(IoSession, ByteBuffer)
anddecode(IoSession, ByteBuffer, ProtocolDecoderOutput)
. Please refer to each method's documentation for detailed explanation.
-
-
Method Details
-
decodable
Checks the specified buffer is decodable by this decoder. -
decode
MessageDecoderResult decode(IoSession session, ByteBuffer in, ProtocolDecoderOutput out) throws Exception Decodes binary or protocol-specific content into higher-level message objects. MINA invokesdecode(IoSession, ByteBuffer, ProtocolDecoderOutput)
method with read data, and then the decoder implementation puts decoded messages intoProtocolDecoderOutput
. -
finishDecode
Invoked when the specified session is closed while this decoder was parsing the data. This method is useful when you deal with the protocol which doesn't specify the length of a message such as HTTP response without content-length header. Implement this method to process the remaining data thatdecode(IoSession, ByteBuffer, ProtocolDecoderOutput)
method didn't process completely.- Throws:
Exception
- if the read data violated protocol specification
-