public class ArduinoCodec extends Object implements ProtocolEncoder, ProtocolDecoder
Constructor and Description |
---|
ArduinoCodec() |
Modifier and Type | Method and Description |
---|---|
void |
decode(IoSession session,
IoBuffer data,
ProtocolDecoderOutput output)
Decodes binary or protocol-specific content into higher-level message objects.
|
void |
dispose(IoSession session)
Releases all resources related with this encoder.
|
void |
encode(IoSession session,
Object message,
ProtocolEncoderOutput output)
Encodes higher-level message objects into binary or protocol-specific data.
|
void |
finishDecode(IoSession session,
ProtocolDecoderOutput output)
Invoked when the specified session is closed.
|
public void decode(IoSession session, IoBuffer data, ProtocolDecoderOutput output) throws Exception
ProtocolDecoder
ProtocolDecoder.decode(IoSession, IoBuffer, ProtocolDecoderOutput)
method with read data, and then the decoder implementation puts decoded
messages into ProtocolDecoderOutput
.decode
in interface ProtocolDecoder
Exception
- if the read data violated protocol specificationpublic void finishDecode(IoSession session, ProtocolDecoderOutput output) throws Exception
ProtocolDecoder
ProtocolDecoder.decode(IoSession, IoBuffer, ProtocolDecoderOutput)
method didn't process completely.finishDecode
in interface ProtocolDecoder
Exception
- if the read data violated protocol specificationpublic void dispose(IoSession session) throws Exception
ProtocolEncoder
dispose
in interface ProtocolDecoder
dispose
in interface ProtocolEncoder
Exception
- if failed to dispose all resourcespublic void encode(IoSession session, Object message, ProtocolEncoderOutput output) throws Exception
ProtocolEncoder
ProtocolEncoder.encode(IoSession, Object, ProtocolEncoderOutput)
method with message which is popped from the session write queue, and then
the encoder implementation puts encoded messages (typically IoBuffer
s)
into ProtocolEncoderOutput
.encode
in interface ProtocolEncoder
Exception
- if the message violated protocol specification