org.apache.mina.filter.codec.serialization

## Class ObjectSerializationEncoder

- java.lang.Object
- - org.apache.mina.filter.codec.ProtocolEncoderAdapter
  - - org.apache.mina.filter.codec.serialization.ObjectSerializationEncoder

- All Implemented Interfaces:
    ProtocolEncoder

      public class ObjectSerializationEncoder
      extends ProtocolEncoderAdapter

  A `ProtocolEncoder` which serializes `Serializable` Java objects using `IoBuffer.putObject(Object)`.
  Author:
    Apache MINA Project

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ObjectSerializationEncoder()` Creates a new instance.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `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 messages (typically `IoBuffer`s) into `ProtocolEncoderOutput`.
      Throws:
        `Exception` - if the message violated protocol specification

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