org.jboss.netty.handler.codec.serialization

## Class CompatibleObjectDecoder

- java.lang.Object
- - org.jboss.netty.channel.SimpleChannelUpstreamHandler
  - - org.jboss.netty.handler.codec.frame.FrameDecoder
    - - org.jboss.netty.handler.codec.replay.ReplayingDecoder<org.jboss.netty.handler.codec.serialization.CompatibleObjectDecoderState>
      - - org.jboss.netty.handler.codec.serialization.CompatibleObjectDecoder

- All Implemented Interfaces:
    ChannelHandler, ChannelUpstreamHandler, LifeCycleAwareChannelHandler

  Deprecated.
  This decoder has a known critical bug which fails to decode and raises a random exception in some circumstances. Avoid to use it whenever you can. The only workaround is to replace `CompatibleObjectEncoder`, `CompatibleObjectDecoder`, `ObjectInputStream`, and `ObjectOutputStream` with `ObjectEncoder`, `ObjectDecoder`, `ObjectEncoderOutputStream`, and `ObjectDecoderInputStream` respectively. This workaround requires both a client and a server to be modified.

      @Deprecated
      public class CompatibleObjectDecoder
      extends ReplayingDecoder<org.jboss.netty.handler.codec.serialization.CompatibleObjectDecoderState>

  A decoder which deserializes the received `ChannelBuffer`s into Java objects (interoperability version).

  This decoder is interoperable with the standard Java object streams such as `ObjectInputStream` and `ObjectOutputStream`.

  However, this decoder might perform worse than `ObjectDecoder` if the serialized object is big and complex. Also, it does not limit the maximum size of the object, and consequently your application might face the risk of DoS attack. Please use `ObjectEncoder` and `ObjectDecoder` if you are not required to keep the interoperability with the standard object streams.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.jboss.netty.channel.ChannelHandler

      `ChannelHandler.Sharable`

  - ### Field Summary

    - ### Fields inherited from class org.jboss.netty.handler.codec.frame.FrameDecoder

      `cumulation, DEFAULT_MAX_COMPOSITEBUFFER_COMPONENTS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CompatibleObjectDecoder()` Deprecated. Creates a new decoder.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected Object` | `decode(ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer, org.jboss.netty.handler.codec.serialization.CompatibleObjectDecoderState state)` Deprecated. Decodes the received packets so far into a frame.
    `protected Object` | `decodeLast(ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer, org.jboss.netty.handler.codec.serialization.CompatibleObjectDecoderState state)` Deprecated. Decodes the received data so far into a frame when the channel is disconnected.
    `protected ObjectInputStream` | `newObjectInputStream(InputStream in)` Deprecated. Creates a new `ObjectInputStream` which wraps the specified `InputStream`.

    - ### Methods inherited from class org.jboss.netty.handler.codec.replay.ReplayingDecoder

      `checkpoint, checkpoint, cleanup, decode, decodeLast, getState, internalBuffer, messageReceived, setState`

    - ### Methods inherited from class org.jboss.netty.handler.codec.frame.FrameDecoder

      `actualReadableBytes, afterAdd, afterRemove, appendToCumulation, beforeAdd, beforeRemove, channelClosed, channelDisconnected, exceptionCaught, getMaxCumulationBufferCapacity, getMaxCumulationBufferComponents, isUnfold, newCumulationBuffer, replace, setMaxCumulationBufferCapacity, setMaxCumulationBufferComponents, setUnfold, unfoldAndFireMessageReceived, updateCumulation`

    - ### Methods inherited from class org.jboss.netty.channel.SimpleChannelUpstreamHandler

      `channelBound, channelConnected, channelInterestChanged, channelOpen, channelUnbound, childChannelClosed, childChannelOpen, handleUpstream, writeComplete`

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

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

- - ### Constructor Detail

    - #### CompatibleObjectDecoder

          public CompatibleObjectDecoder()

      Deprecated.
      Creates a new decoder.

  - ### Method Detail

    - #### newObjectInputStream

          protected ObjectInputStream newObjectInputStream(InputStream in)
                                                    throws Exception

      Deprecated.
      Creates a new `ObjectInputStream` which wraps the specified `InputStream`. Override this method to use a subclass of the `ObjectInputStream`.
      Throws:
        `Exception`

    - #### decode

          protected Object decode(ChannelHandlerContext ctx,
                      Channel channel,
                      ChannelBuffer buffer,
                      org.jboss.netty.handler.codec.serialization.CompatibleObjectDecoderState state)
                           throws Exception

      Deprecated.
      Description copied from class: `ReplayingDecoder`
      Decodes the received packets so far into a frame.
      Specified by:
        `decode` in class `ReplayingDecoder<org.jboss.netty.handler.codec.serialization.CompatibleObjectDecoderState>`
      Parameters:
        `ctx` - the context of this handler
        `channel` - the current channel
        `buffer` - the cumulative buffer of received packets so far. Note that the buffer might be empty, which means you should not make an assumption that the buffer contains at least one byte in your decoder implementation.
        `state` - the current decoder state (`null` if unused)
      Returns:
        the decoded frame
      Throws:
        `Exception`

    - #### decodeLast

          protected Object decodeLast(ChannelHandlerContext ctx,
                          Channel channel,
                          ChannelBuffer buffer,
                          org.jboss.netty.handler.codec.serialization.CompatibleObjectDecoderState state)
                               throws Exception

      Deprecated.
      Description copied from class: `ReplayingDecoder`
      Decodes the received data so far into a frame when the channel is disconnected.
      Overrides:
        `decodeLast` in class `ReplayingDecoder<org.jboss.netty.handler.codec.serialization.CompatibleObjectDecoderState>`
      Parameters:
        `ctx` - the context of this handler
        `channel` - the current channel
        `buffer` - the cumulative buffer of received packets so far. Note that the buffer might be empty, which means you should not make an assumption that the buffer contains at least one byte in your decoder implementation.
        `state` - the current decoder state (`null` if unused)
      Returns:
        the decoded frame
      Throws:
        `Exception`

Copyright © 2008-2012 The Netty Project. All Rights Reserved.