org.jboss.netty.handler.codec.compression
Class ZlibDecoder

java.lang.Object
  extended by org.jboss.netty.handler.codec.oneone.OneToOneDecoder
      extended by org.jboss.netty.handler.codec.compression.ZlibDecoder
All Implemented Interfaces:
ChannelHandler, ChannelUpstreamHandler

public class ZlibDecoder
extends OneToOneDecoder

Decompresses a ChannelBuffer using the deflate algorithm.

Version:
$Rev: 2241 $, $Date: 2010-04-16 13:12:43 +0900 (Fri, 16 Apr 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
ZlibDecoder()
          Creates a new instance with the default wrapper (ZlibWrapper.ZLIB).
ZlibDecoder(byte[] dictionary)
          Creates a new instance with the specified preset dictionary.
ZlibDecoder(ZlibWrapper wrapper)
          Creates a new instance with the specified wrapper.
 
Method Summary
protected  Object decode(ChannelHandlerContext ctx, Channel channel, Object msg)
          Transforms the specified received message into another message and return the transformed message.
 boolean isClosed()
          Returns true if and only if the end of the compressed stream has been reached.
 
Methods inherited from class org.jboss.netty.handler.codec.oneone.OneToOneDecoder
handleUpstream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ZlibDecoder

public ZlibDecoder()
Creates a new instance with the default wrapper (ZlibWrapper.ZLIB).

Throws:
CompressionException - if failed to initialize zlib

ZlibDecoder

public ZlibDecoder(ZlibWrapper wrapper)
Creates a new instance with the specified wrapper.

Throws:
CompressionException - if failed to initialize zlib

ZlibDecoder

public ZlibDecoder(byte[] dictionary)
Creates a new instance with the specified preset dictionary. The wrapper is always ZlibWrapper.ZLIB because it is the only format that supports the preset dictionary.

Throws:
CompressionException - if failed to initialize zlib
Method Detail

isClosed

public boolean isClosed()
Returns true if and only if the end of the compressed stream has been reached.


decode

protected Object decode(ChannelHandlerContext ctx,
                        Channel channel,
                        Object msg)
                 throws Exception
Description copied from class: OneToOneDecoder
Transforms the specified received message into another message and return the transformed message. Return null if the received message is supposed to be discarded.

Specified by:
decode in class OneToOneDecoder
Throws:
Exception


Copyright © 2008-2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.