org.apache.mina.filter.codec

## Interface ProtocolEncoder

- All Known Implementing Classes:
    DemuxingProtocolEncoder, HttpClientEncoder, HttpServerEncoder, ImageRequestEncoder, ImageResponseEncoder, ObjectSerializationEncoder, PrefixedStringEncoder, ProtocolEncoderAdapter, SynchronizedProtocolEncoder, TextLineEncoder

      public interface ProtocolEncoder

  Encodes higher-level message objects into binary or protocol-specific data. MINA invokes `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` by calling `ProtocolEncoderOutput.write(Object)`.

  Please refer to `TextLineEncoder` example.

  Author:
    Apache MINA Project
  See Also:
    `ProtocolEncoderException`

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `dispose(IoSession session)` Releases all resources related with this encoder.
    `void` | `encode(IoSession session, Object message, ProtocolEncoderOutput out)` Encodes higher-level message objects into binary or protocol-specific data.

- - ### Method Detail

    - #### encode

          void encode(IoSession session,
                    Object message,
                    ProtocolEncoderOutput out)
                      throws Exception

      Encodes higher-level message objects into binary or protocol-specific data. MINA invokes `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

    - #### dispose

          void dispose(IoSession session)
                       throws Exception

      Releases all resources related with this encoder.
      Throws:
        `Exception` - if failed to dispose all resources

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