public class DecodingStateProtocolDecoder extends Object implements ProtocolDecoder
ProtocolDecoder which uses a DecodingState to decode data.
Use a DecodingStateMachine as DecodingState to create
a state machine which can decode your protocol.
NOTE: This is a stateful decoder. You should create one instance per session.
| Constructor and Description |
|---|
DecodingStateProtocolDecoder(DecodingState state)
Creates a new instance using the specified
DecodingState
instance. |
| Modifier and Type | Method and Description |
|---|---|
void |
decode(IoSession session,
IoBuffer in,
ProtocolDecoderOutput out)
Decodes binary or protocol-specific content into higher-level message objects.
|
void |
dispose(IoSession session)
Releases all resources related with this decoder.
|
void |
finishDecode(IoSession session,
ProtocolDecoderOutput out)
Invoked when the specified
session is closed. |
public DecodingStateProtocolDecoder(DecodingState state)
DecodingState
instance.state - the DecodingState.IllegalArgumentException - if the specified state is null.public void decode(IoSession session, IoBuffer in, ProtocolDecoderOutput out) throws Exception
ProtocolDecoder.decode(IoSession, IoBuffer, ProtocolDecoderOutput)
method with read data, and then the decoder implementation puts decoded
messages into ProtocolDecoderOutput.decode in interface ProtocolDecodersession - The current Sessionin - the buffer to decodeout - The ProtocolDecoderOutput that will receive the decoded messageException - if the read data violated protocol specificationpublic void finishDecode(IoSession session, ProtocolDecoderOutput out) throws Exception
session is closed. 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 that ProtocolDecoder.decode(IoSession, IoBuffer, ProtocolDecoderOutput)
method didn't process completely.finishDecode in interface ProtocolDecodersession - The current Sessionout - The ProtocolDecoderOutput that contains the decoded messageException - if the read data violated protocol specificationpublic void dispose(IoSession session) throws Exception
dispose in interface ProtocolDecodersession - The current SessionException - if failed to dispose all resourcesCopyright © 2004–2024 Apache MINA Project. All rights reserved.