org.apache.mina.codec

## Interface ProtocolEncoder<INPUT,OUTPUT,ENCODING_STATE>

- Type Parameters:
    `INPUT` - the incoming message to encode (your high level protocol Pojo/DTO)
    `OUTPUT` - the encoded message (the low level message, usually a `ByteBuffer`)
    `ENCODING_STATE` - the context where to save the current encoding state (e.g. encoding context switching..)
  All Known Subinterfaces:
    StatelessProtocolEncoder<INPUT,OUTPUT>
  All Known Implementing Classes:
    ByteBufferEncoder, CoapEncoder, HttpServerEncoder, JavaNativeMessageEncoder, ProtobufEncoder, ProtobufMessageEncoder, SizePrefixedEncoder, TextLineEncoder, ThriftEncoder, ThriftMessageEncoder

      public interface ProtocolEncoder<INPUT,OUTPUT,ENCODING_STATE>

  In charge of encoding a message of type MESSAGE into another form (could be a `ByteBuffer` or any other protocol level construction. Must be immutable, a CONTEXT will be provided per session.
  Author:
    Apache MINA Project

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `ENCODING_STATE` | `createEncoderState()` Create a new session context for this decoder
    `OUTPUT` | `encode(INPUT message, ENCODING_STATE context)` Encodes higher-level message objects of type `INPUT` into binary or protocol-specific data of type `OUTPUT`.

- - ### Method Detail

    - #### createEncoderState

          ENCODING_STATE createEncoderState()

      Create a new session context for this decoder
      Returns:
        the newly created context

    - #### encode

          OUTPUT encode(INPUT message,
                      ENCODING_STATE context)

      Encodes higher-level message objects of type `INPUT` into binary or protocol-specific data of type `OUTPUT`.
      Parameters:
        `message` - the message to encode
        `context` - the encoding context (will be stored in the session for the next decode call)

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