org.apache.mina.examples.sumup.codec
Class AbstractMessageEncoder

java.lang.Object
  extended by org.apache.mina.examples.sumup.codec.AbstractMessageEncoder
All Implemented Interfaces:
MessageEncoder, ProtocolEncoder
Direct Known Subclasses:
AddMessageEncoder, ResultMessageEncoder

public abstract class AbstractMessageEncoder
extends Object
implements MessageEncoder

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

Version:
$Rev: 332218 $, $Date: 2005-11-10 12:52:42 +0900 $
Author:
The Apache Directory Project

Constructor Summary
protected AbstractMessageEncoder(int type)
           
 
Method Summary
 void encode(ProtocolSession session, Object message, ProtocolEncoderOutput out)
          Encodes higher-level message objects into binary or protocol-specific data.
protected abstract  void encodeBody(ProtocolSession session, AbstractMessage message, ByteBuffer out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.mina.protocol.codec.MessageEncoder
getMessageTypes
 

Constructor Detail

AbstractMessageEncoder

protected AbstractMessageEncoder(int type)
Method Detail

encode

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

Specified by:
encode in interface ProtocolEncoder
Throws:
ProtocolViolationException - if the message violated protocol specification

encodeBody

protected abstract void encodeBody(ProtocolSession session,
                                   AbstractMessage message,
                                   ByteBuffer out)


Copyright © 2004-2005 . All Rights Reserved.