org.apache.mina.filter.codec

## Interface ProtocolDecoder

- All Known Implementing Classes:
    CommandDecoder, CumulativeProtocolDecoder, DecodingStateProtocolDecoder, DemuxingProtocolDecoder, HttpClientDecoder, HttpServerDecoder, ImageRequestDecoder, ImageResponseDecoder, ObjectSerializationDecoder, PrefixedStringDecoder, ProtocolDecoderAdapter, SynchronizedProtocolDecoder, TextLineDecoder

      public interface ProtocolDecoder

  Decodes binary or protocol-specific data into higher-level message objects. MINA invokes `decode(IoSession, IoBuffer, ProtocolDecoderOutput)` method with read data, and then the decoder implementation puts decoded messages into `ProtocolDecoderOutput` by calling `ProtocolDecoderOutput.write(Object)`.

  Please refer to `TextLineDecoder` example.

  Author:
    Apache MINA Project
  See Also:
    `ProtocolDecoderException`

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `decode(IoSession session, IoBuffer in, ProtocolDecoderOutput out)` Decodes binary or protocol-specific content into higher-level message objects.
    `void` | `dispose(IoSession session)` Releases all resources related with this decoder.
    `void` | `finishDecode(IoSession session, ProtocolDecoderOutput out)` Invoked when the specified `session` is closed.

- - ### Method Detail

    - #### decode

          void decode(IoSession session,
                    IoBuffer in,
                    ProtocolDecoderOutput out)
                      throws Exception

      Decodes binary or protocol-specific content into higher-level message objects. MINA invokes `decode(IoSession, IoBuffer, ProtocolDecoderOutput)` method with read data, and then the decoder implementation puts decoded messages into `ProtocolDecoderOutput`.
      Throws:
        `Exception` - if the read data violated protocol specification

    - #### finishDecode

          void finishDecode(IoSession session,
                          ProtocolDecoderOutput out)
                            throws Exception

      Invoked when the specified `session` is closed. This method is useful when you deal with the protocol which doesn't specify the length of a message such as HTTP response without `content-length` header. Implement this method to process the remaining data that `decode(IoSession, IoBuffer, ProtocolDecoderOutput)` method didn't process completely.
      Throws:
        `Exception` - if the read data violated protocol specification

    - #### dispose

          void dispose(IoSession session)
                       throws Exception

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

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