Package org.apache.mina.filter.codec
Interface ProtocolDecoder
-
- All Known Implementing Classes:
CumulativeProtocolDecoder,DecodingStateProtocolDecoder,DemuxingProtocolDecoder,ObjectSerializationDecoder,PrefixedStringDecoder,ProtocolDecoderAdapter,SynchronizedProtocolDecoder,TextLineDecoder
public interface ProtocolDecoderDecodes binary or protocol-specific data into higher-level message objects. MINA invokesdecode(IoSession, IoBuffer, ProtocolDecoderOutput)method with read data, and then the decoder implementation puts decoded messages intoProtocolDecoderOutputby callingProtocolDecoderOutput.write(Object).Please refer to
TextLineDecoderexample.- Author:
- Apache MINA Project
- See Also:
ProtocolDecoderException
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voiddecode(IoSession session, IoBuffer in, ProtocolDecoderOutput out)Decodes binary or protocol-specific content into higher-level message objects.voiddispose(IoSession session)Releases all resources related with this decoder.voidfinishDecode(IoSession session, ProtocolDecoderOutput out)Invoked when the specified session is closed.
-
-
-
Method Detail
-
decode
void decode(IoSession session, IoBuffer in, ProtocolDecoderOutput out) throws Exception
Decodes binary or protocol-specific content into higher-level message objects. MINA invokesdecode(IoSession, IoBuffer, ProtocolDecoderOutput)method with read data, and then the decoder implementation puts decoded messages intoProtocolDecoderOutput.- Parameters:
session- The current Sessionin- the buffer to decodeout- TheProtocolDecoderOutputthat will receive the decoded message- Throws:
Exception- if the read data violated protocol specification
-
finishDecode
void finishDecode(IoSession session, ProtocolDecoderOutput out) throws Exception
Invoked when the specified 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 thatdecode(IoSession, IoBuffer, ProtocolDecoderOutput)method didn't process completely.- Parameters:
session- The current Sessionout- TheProtocolDecoderOutputthat contains the decoded message- Throws:
Exception- if the read data violated protocol specification
-
-