org.apache.mina.filter.codec

Interface ProtocolEncoder

Known Implementing Classes:
ObjectSerializationEncoder, ProtocolEncoderAdapter, SynchronizedProtocolEncoder, TextLineEncoder

public interface ProtocolEncoder

Encodes higher-level message objects into binary or protocol-specific data. MINA invokes encode(IoSession,Object,ProtocolEncoderOutput) method with message which is popped from the session write queue, and then the encoder implementation puts encoded ByteBuffers into ProtocolEncoderOutput by calling ProtocolEncoderOutput.write(ByteBuffer).

Please refer to TextLineEncoder example.

Method Summary

void
dispose(IoSession session)
Releases all resources related with this encoder.
void
encode(IoSession session, Object message, ProtocolEncoderOutput out)
Encodes higher-level message objects into binary or protocol-specific data.

Method Details

dispose

public void dispose(IoSession session)
            throws Exception
Releases all resources related with this encoder.

encode

public void encode(IoSession session,
                   Object message,
                   ProtocolEncoderOutput out)
            throws Exception
Encodes higher-level message objects into binary or protocol-specific data. MINA invokes encode(IoSession,Object,ProtocolEncoderOutput) method with message which is popped from the session write queue, and then the encoder implementation puts encoded ByteBuffers into ProtocolEncoderOutput.