org.apache.mina.codec

## Interface ProtocolDecoder<INPUT,OUTPUT,DECODING_STATE>

- Type Parameters:
    `INPUT` - the incoming message to decode (the low level message, usually a `ByteBuffer`)
    `OUTPUT` - the decoded message (your high level protocol Pojo/DTO)
    `DECODING_STATE` - the context where to save the current decoding state (e.g. accumulated bytes, encoding context switching..)
  All Known Subinterfaces:
    StatelessProtocolDecoder<INPUT,OUTPUT>
  All Known Implementing Classes:
    CoapDecoder, HttpServerDecoder, IoBufferDecoder, JavaNativeMessageDecoder, ProtobufDecoder, ProtobufDynamicDecoder, ProtobufDynamicMessageDecoder, ProtobufMessageDecoder, SizePrefixedDecoder, TextLineDecoder, ThriftDecoder, ThriftDynamicDecoder, ThriftDynamicMessageDecoder, ThriftMessageDecoder

      public interface ProtocolDecoder<INPUT,OUTPUT,DECODING_STATE>

  Decodes binary or protocol-specific data into higher-level message objects. Must be immutable, a CONTEXT will be provided per session.
  Author:
    Apache MINA Project

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `DECODING_STATE` | `createDecoderState()` Create a new session context for this decoder
    `OUTPUT` | `decode(INPUT input, DECODING_STATE context)` Decode binary or protocol-specific content of type `INPUT` into higher-level protocol message objects, of type OUTPUT
    `void` | `finishDecode(DECODING_STATE context)` Finish decoding, for example if the decoder accumulated some unused input, it should discard it, or throw an Exception

- - ### Method Detail

    - #### createDecoderState

          DECODING_STATE createDecoderState()

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

    - #### decode

          OUTPUT decode(INPUT input,
                      DECODING_STATE context)

      Decode binary or protocol-specific content of type `INPUT` into higher-level protocol message objects, of type OUTPUT
      Parameters:
        `input` - the received message to decode
        `context` - the decoding context (will be stored in the session for the next decode call)
      Returns:
        the decoded message or `null` if nothing was decoded

    - #### finishDecode

          void finishDecode(DECODING_STATE context)

      Finish decoding, for example if the decoder accumulated some unused input, it should discard it, or throw an Exception

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