Class ZlibDecoder
java.lang.Object
org.jboss.netty.handler.codec.oneone.OneToOneDecoder
org.jboss.netty.handler.codec.compression.ZlibDecoder
- All Implemented Interfaces:
ChannelHandler
,ChannelUpstreamHandler
Decompresses a
ChannelBuffer
using the deflate algorithm.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.jboss.netty.channel.ChannelHandler
ChannelHandler.Sharable
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate byte[]
private boolean
private final com.jcraft.jzlib.ZStream
-
Constructor Summary
ConstructorsConstructorDescriptionCreates 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
Modifier and TypeMethodDescriptionprotected Object
decode
(ChannelHandlerContext ctx, Channel channel, Object msg) Transforms the specified received message into another message and return the transformed message.boolean
isClosed()
Returnstrue
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
-
Field Details
-
z
private final com.jcraft.jzlib.ZStream z -
dictionary
private byte[] dictionary -
finished
private volatile boolean finished
-
-
Constructor Details
-
ZlibDecoder
public ZlibDecoder()Creates a new instance with the default wrapper (ZlibWrapper.ZLIB
).- Throws:
CompressionException
- if failed to initialize zlib
-
ZlibDecoder
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 alwaysZlibWrapper.ZLIB
because it is the only format that supports the preset dictionary.- Throws:
CompressionException
- if failed to initialize zlib
-
-
Method Details
-
isClosed
public boolean isClosed()Returnstrue
if and only if the end of the compressed stream has been reached. -
decode
Description copied from class:OneToOneDecoder
Transforms the specified received message into another message and return the transformed message. Returnnull
if the received message is supposed to be discarded.- Specified by:
decode
in classOneToOneDecoder
- Throws:
Exception
-