org.apache.mina.codec.delimited.serialization

## Class ThriftMessageDecoder<OUTPUT extends org.apache.thrift.TBase<?,?>>

- java.lang.Object
- - org.apache.mina.codec.delimited.IoBufferDecoder<OUTPUT>
  - - org.apache.mina.codec.delimited.serialization.ThriftMessageDecoder<OUTPUT>

- Type Parameters:
    `OUTPUT` - the base type for decoded messages.
  All Implemented Interfaces:
    ProtocolDecoder<IoBuffer,OUTPUT,Void>, StatelessProtocolDecoder<IoBuffer,OUTPUT>

      public class ThriftMessageDecoder<OUTPUT extends org.apache.thrift.TBase<?,?>>
      extends IoBufferDecoder<OUTPUT>

  Decode `IoBuffer` into Thrift messages.
  Author:
    Apache MINA Project

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ThriftMessageDecoder(Class<OUTPUT> clazz)` Create thrift message decoder

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `OUTPUT` | `decode(IoBuffer input)` Decodes a message from a `IoBuffer` When a truncated input is given to this method it may return null.
    `static <L extends org.apache.thrift.TBase<?,?>> ThriftMessageDecoder<L>` | `newInstance(Class<L> clazz)`

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

      `createDecoderState, decode, finishDecode`

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

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

- - ### Constructor Detail

    - #### ThriftMessageDecoder

          public ThriftMessageDecoder(Class<OUTPUT> clazz)

      Create thrift message decoder
      Parameters:
        `clazz` - the base class for decoded messages

  - ### Method Detail

    - #### newInstance

          public static <L extends org.apache.thrift.TBase<?,?>> ThriftMessageDecoder<L> newInstance(Class<L> clazz)

    - #### decode

          public OUTPUT decode(IoBuffer input)

      Decodes a message from a `IoBuffer`

      When a truncated input is given to this method it may return null. Not all decoder will be able to detect this issue and report it that way. Thanks to prefixing of messages, decoder will only receive appropriately sized ByteBuffers.

      n.b. The decoders used for the prefixing (i.e. `RawInt32` and `VarInt`) have to detect truncated ByteBuffers.

      Specified by:
        `decode` in class `IoBufferDecoder<OUTPUT extends org.apache.thrift.TBase<?,?>>`
      Parameters:
        `input` - data to be decoded as a TYPE message
      Returns:
        the decoded message on success, null otherwise

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