org.apache.mina.filter.codec.serialization
Class ObjectSerializationEncoder

java.lang.Object
  extended by org.apache.mina.filter.codec.ProtocolEncoderAdapter
      extended by org.apache.mina.filter.codec.serialization.ObjectSerializationEncoder
All Implemented Interfaces:
ProtocolEncoder

public class ObjectSerializationEncoder
extends ProtocolEncoderAdapter

A ProtocolEncoder which serializes Serializable Java objects using ByteBuffer.putObject(Object).

Version:
$Rev: 436993 $, $Date: 2006-08-26 00:36:56 +0200 (Sat, 26 Aug 2006) $
Author:
The Apache Directory Project (mina-dev@directory.apache.org)

Constructor Summary
ObjectSerializationEncoder()
          Creates a new instance.
 
Method Summary
 void encode(IoSession session, Object message, ProtocolEncoderOutput out)
          Encodes higher-level message objects into binary or protocol-specific data.
 int getMaxObjectSize()
          Returns the allowed maximum size of the encoded object.
 void setMaxObjectSize(int maxObjectSize)
          Sets the allowed maximum size of the encoded object.
 
Methods inherited from class org.apache.mina.filter.codec.ProtocolEncoderAdapter
dispose
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectSerializationEncoder

public ObjectSerializationEncoder()
Creates a new instance.

Method Detail

getMaxObjectSize

public int getMaxObjectSize()
Returns the allowed maximum size of the encoded object. If the size of the encoded object exceeds this value, this encoder will throw a IllegalArgumentException. The default value is Integer.MAX_VALUE.


setMaxObjectSize

public void setMaxObjectSize(int maxObjectSize)
Sets the allowed maximum size of the encoded object. If the size of the encoded object exceeds this value, this encoder will throw a IllegalArgumentException. The default value is Integer.MAX_VALUE.


encode

public void encode(IoSession session,
                   Object message,
                   ProtocolEncoderOutput out)
            throws Exception
Description copied from interface: ProtocolEncoder
Encodes higher-level message objects into binary or protocol-specific data. MINA invokes ProtocolEncoder.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.

Throws:
Exception - if the message violated protocol specification


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