org.apache.mina.example.sumup.codec
Class AbstractMessageEncoder<T extends AbstractMessage>

java.lang.Object
  extended by org.apache.mina.example.sumup.codec.AbstractMessageEncoder<T>
All Implemented Interfaces:
MessageEncoder<T>
Direct Known Subclasses:
AddMessageEncoder, ResultMessageEncoder

public abstract class AbstractMessageEncoder<T extends AbstractMessage>
extends Object
implements MessageEncoder<T>

A MessageEncoder that encodes message header and forwards the encoding of body to a subclass.

Author:
Apache MINA Project

Constructor Summary
protected AbstractMessageEncoder(int type)
           
 
Method Summary
 void encode(IoSession session, T message, ProtocolEncoderOutput out)
          Encodes higher-level message objects into binary or protocol-specific data.
protected abstract  void encodeBody(IoSession session, T message, IoBuffer out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractMessageEncoder

protected AbstractMessageEncoder(int type)
Method Detail

encode

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

Specified by:
encode in interface MessageEncoder<T extends AbstractMessage>
Throws:
Exception - if the message violated protocol specification

encodeBody

protected abstract void encodeBody(IoSession session,
                                   T message,
                                   IoBuffer out)


Copyright © 2004-2011 Apache MINA Project. All Rights Reserved.