## org.jboss.netty.handler.codec.serialization
Class CompatibleObjectDecoder

    java.lang.Object
      org.jboss.netty.channel.SimpleChannelUpstreamHandler
          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

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.

Version:
  $Rev: 2188 $, $Date: 2010-02-19 18:00:00 +0900 (Fri, 19 Feb 2010) $
Author:
  The Netty Project, Trustin Lee

Nested Class Summary

Nested classes/interfaces inherited from interface org.jboss.netty.channel.ChannelHandler
`ChannelHandler.Sharable`

Constructor Summary
`CompatibleObjectDecoder()` Deprecated. Creates a new decoder.

Method Summary
`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
`actualReadableBytes, channelClosed, channelDisconnected, checkpoint, checkpoint, exceptionCaught, getState, internalBuffer, messageReceived, setState`

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-2010 JBoss, a division of Red Hat, Inc.. All Rights Reserved.