org.apache.mina.codec.delimited.serialization

## Class JavaNativeMessageEncoder<OUT extends Serializable>

- java.lang.Object
- - org.apache.mina.codec.delimited.ByteBufferEncoder<OUT>
  - - org.apache.mina.codec.delimited.serialization.JavaNativeMessageEncoder<OUT>

- All Implemented Interfaces:
    ProtocolEncoder<OUT,ByteBuffer,Void>, StatelessProtocolEncoder<OUT,ByteBuffer>

      public class JavaNativeMessageEncoder<OUT extends Serializable>
      extends ByteBufferEncoder<OUT>

  Encoder providing the built-in Java-serialization.
  Author:
    Apache MINA Project

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `JavaNativeMessageEncoder()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `ByteBuffer` | `encode(OUT message)` Encodes a message to a `ByteBuffer`
    `int` | `getEncodedSize(OUT message)` Computes the size of the serialized form of a message in bytes.
    `void` | `writeTo(OUT message, ByteBuffer buffer)` Writes a message on a `ByteBuffer`.

    - ### Methods inherited from class org.apache.mina.codec.delimited.ByteBufferEncoder

      `createEncoderState, encode`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### JavaNativeMessageEncoder

          public JavaNativeMessageEncoder()

  - ### Method Detail

    - #### encode

          public ByteBuffer encode(OUT message)

      Description copied from class: `ByteBufferEncoder`
      Encodes a message to a `ByteBuffer`
      Overrides:
        `encode` in class `ByteBufferEncoder<OUT extends Serializable>`
      Parameters:
        `message` - a message to be encoded
      Returns:
        the buffer containing `ByteBuffer` representation of the message

    - #### getEncodedSize

          public int getEncodedSize(OUT message)

      Description copied from class: `ByteBufferEncoder`
      Computes the size of the serialized form of a message in bytes.
      Specified by:
        `getEncodedSize` in class `ByteBufferEncoder<OUT extends Serializable>`
      Parameters:
        `message` - a message to be encoded
      Returns:
        the size of the serialized form of the message

    - #### writeTo

          public void writeTo(OUT message,
                     ByteBuffer buffer)

      Description copied from class: `ByteBufferEncoder`
      Writes a message on a `ByteBuffer`.

      n.b. The buffer is expected to have at least a sufficient capacity to handle the serialized form of the message.

      Specified by:
        `writeTo` in class `ByteBufferEncoder<OUT extends Serializable>`
      Parameters:
        `message` - a message to be encoded
        `buffer` - a target `ByteBuffer`

Copyright © 2009–2013 Apache MINA Project. All rights reserved.