org.apache.mina.codec.delimited.serialization

## Class ProtobufDynamicMessageDecoder

- java.lang.Object
- - org.apache.mina.codec.delimited.IoBufferDecoder<ProtobufDynamicMessageDecoder.ProtobufSerializedMessage>
  - - org.apache.mina.codec.delimited.serialization.ProtobufDynamicMessageDecoder

- All Implemented Interfaces:
    ProtocolDecoder<IoBuffer,ProtobufDynamicMessageDecoder.ProtobufSerializedMessage,Void>, StatelessProtocolDecoder<IoBuffer,ProtobufDynamicMessageDecoder.ProtobufSerializedMessage>

      public class ProtobufDynamicMessageDecoder
      extends IoBufferDecoder<ProtobufDynamicMessageDecoder.ProtobufSerializedMessage>

  An alternative decoder for protobuf which allows the use various target classes with the same decoder. This decoder converts incoming `IoBuffer` into `ProtobufDynamicMessageDecoder.ProtobufSerializedMessage`.
  Author:
    Apache MINA Project

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `ProtobufDynamicMessageDecoder.ProtobufSerializedMessage`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ProtobufDynamicMessageDecoder()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `ProtobufDynamicMessageDecoder.ProtobufSerializedMessage` | `decode(IoBuffer input)` Decodes a message from a `IoBuffer` When a truncated input is given to this method it may return null.
    `static ProtobufDynamicMessageDecoder` | `newInstance()`

    - ### 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

    - #### ProtobufDynamicMessageDecoder

          public ProtobufDynamicMessageDecoder()

  - ### Method Detail

    - #### newInstance

          public static ProtobufDynamicMessageDecoder newInstance()

    - #### decode

          public ProtobufDynamicMessageDecoder.ProtobufSerializedMessage decode(IoBuffer input)

      Description copied from class: `IoBufferDecoder`
      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<ProtobufDynamicMessageDecoder.ProtobufSerializedMessage>`
      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.