public class ProtocolCodecFilter<MESSAGE,ENCODED,ENCODING_STATE,DECODING_STATE> extends AbstractIoFilter
IoFilter
which translates binary or protocol specific data into message objects and vice versa using
ProtocolCodecFactory
, ProtocolEncoder
, or ProtocolDecoder
.Constructor and Description |
---|
ProtocolCodecFilter(ProtocolEncoder<MESSAGE,ENCODED,ENCODING_STATE> encoder,
ProtocolDecoder<ENCODED,MESSAGE,DECODING_STATE> decoder)
Creates a new instance of ProtocolCodecFilter, with the specified encoder and decoder.
|
Modifier and Type | Method and Description |
---|---|
void |
messageReceived(IoSession session,
Object in,
ReadFilterChainController controller)
Process the incoming message, calling the session decoder.
|
void |
messageWriting(IoSession session,
WriteRequest message,
WriteFilterChainController controller)
Invoked when a message is under writing.
|
void |
sessionClosed(IoSession session)
Invoked when a connection is closed.
|
void |
sessionOpened(IoSession session)
Invoked when a connection has been opened.
|
messageSent, sessionIdle
public ProtocolCodecFilter(ProtocolEncoder<MESSAGE,ENCODED,ENCODING_STATE> encoder, ProtocolDecoder<ENCODED,MESSAGE,DECODING_STATE> decoder)
public void messageReceived(IoSession session, Object in, ReadFilterChainController controller)
while ( buffer not empty )
try
decode ( buffer )
catch
break;
messageReceived
in interface IoFilter
messageReceived
in class AbstractIoFilter
session
- IoSession
associated with the invocationin
- the incoming message to processpublic void messageWriting(IoSession session, WriteRequest message, WriteFilterChainController controller)
messageWriting
in interface IoFilter
messageWriting
in class AbstractIoFilter
session
- IoSession
associated with the invocationmessage
- the message to process before writingpublic void sessionOpened(IoSession session)
sessionOpened
in interface IoFilter
sessionOpened
in class AbstractIoFilter
session
- IoSession
associated with the invocationpublic void sessionClosed(IoSession session)
sessionClosed
in interface IoFilter
sessionClosed
in class AbstractIoFilter
session
- IoSession
associated with the invocationCopyright © 2009–2013 Apache MINA Project. All rights reserved.