Top Fields Constructors Methods
io.netty.handler.codec.compression

public Class JZlibDecoder

extends ZlibDecoder
Class Inheritance
Imports
com.jcraft.jzlib.Inflater, .JZlib, io.netty.buffer.ByteBuf, .ByteBufAllocator, io.netty.channel.ChannelHandlerContext, io.netty.util.internal.ObjectUtil, java.util.List

Field Summary

Modifier and TypeField and Description
private byte[]
private volatile boolean
private final Inflater
z

Deprecated as a consequence of Inflater being deprecated.
Inherited from io.netty.handler.codec.compression.ZlibDecoder:
maxAllocation

Constructor Summary

AccessConstructor and Description
public
JZlibDecoder()

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

public
JZlibDecoder(int
Maximum size of the decompression buffer. Must be >= 0. If zero, maximum size is decided by the ByteBufAllocator.
maxAllocation
)

Creates a new instance with the default wrapper (ZlibWrapper#ZLIB) and specified maximum buffer allocation.

public
JZlibDecoder(ZlibWrapper wrapper)

Creates a new instance with the specified wrapper.

public
JZlibDecoder(ZlibWrapper wrapper, int
Maximum size of the decompression buffer. Must be >= 0. If zero, maximum size is decided by the ByteBufAllocator.
maxAllocation
)

Creates a new instance with the specified wrapper and maximum buffer allocation.

public
JZlibDecoder(byte[] dictionary)

Creates a new instance with the specified preset dictionary.

public
JZlibDecoder(byte[] dictionary, int
Maximum size of the decompression buffer. Must be >= 0. If zero, maximum size is decided by the ByteBufAllocator.
maxAllocation
)

Creates a new instance with the specified preset dictionary and maximum buffer allocation.

Method Summary

Modifier and TypeMethod and Description
protected void
decode(ChannelHandlerContext ctx, ByteBuf
the ByteBuf from which to read data
in
,
List<Object>
the List to which decoded messages should be added
out
)

Implements abstract io.netty.handler.codec.ByteToMessageDecoder.decode.

Decode the from one ByteBuf to an other.
protected void
decompressionBufferExhausted(ByteBuf buffer)

Overrides io.netty.handler.codec.compression.ZlibDecoder.decompressionBufferExhausted.

Called when the decompression buffer cannot be expanded further.
public boolean
isClosed()

Implements abstract io.netty.handler.codec.compression.ZlibDecoder.isClosed.

Returns true if and only if the end of the compressed stream has been reached.
Inherited from io.netty.handler.codec.compression.ZlibDecoder:
prepareDecompressBuffer

Field Detail

dictionaryback to summary
private byte[] dictionary
finishedback to summary
private volatile boolean finished
zback to summary
private final Inflater z

Deprecated

as a consequence of Inflater being deprecated. See corresponding docs for further information.

Constructor Detail

JZlibDecoderback to summary
public JZlibDecoder()

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

Exceptions
DecompressionException:
if failed to initialize zlib
JZlibDecoderback to summary
public JZlibDecoder(int maxAllocation)

Creates a new instance with the default wrapper (ZlibWrapper#ZLIB) and specified maximum buffer allocation.

Parameters
maxAllocation:int

Maximum size of the decompression buffer. Must be >= 0. If zero, maximum size is decided by the ByteBufAllocator.

Exceptions
DecompressionException:
if failed to initialize zlib
JZlibDecoderback to summary
public JZlibDecoder(ZlibWrapper wrapper)

Creates a new instance with the specified wrapper.

Exceptions
DecompressionException:
if failed to initialize zlib
JZlibDecoderback to summary
public JZlibDecoder(ZlibWrapper wrapper, int maxAllocation)

Creates a new instance with the specified wrapper and maximum buffer allocation.

Parameters
maxAllocation:int

Maximum size of the decompression buffer. Must be >= 0. If zero, maximum size is decided by the ByteBufAllocator.

Exceptions
DecompressionException:
if failed to initialize zlib
JZlibDecoderback to summary
public JZlibDecoder(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.

Exceptions
DecompressionException:
if failed to initialize zlib
JZlibDecoderback to summary
public JZlibDecoder(byte[] dictionary, int maxAllocation)

Creates a new instance with the specified preset dictionary and maximum buffer allocation. The wrapper is always ZlibWrapper#ZLIB because it is the only format that supports the preset dictionary.

Parameters
maxAllocation:int

Maximum size of the decompression buffer. Must be >= 0. If zero, maximum size is decided by the ByteBufAllocator.

Exceptions
DecompressionException:
if failed to initialize zlib

Method Detail

decodeback to summary
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception

Implements abstract io.netty.handler.codec.ByteToMessageDecoder.decode.

Doc from io.netty.handler.codec.ByteToMessageDecoder.decode.

Decode the from one ByteBuf to an other. This method will be called till either the input ByteBuf has nothing to read when return from this method or till nothing was read from the input ByteBuf.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext which this ByteToMessageDecoder belongs to

in:ByteBuf

the ByteBuf from which to read data

out:List<Object>

the List to which decoded messages should be added

Annotations
@Override
Exceptions
Exception:
is thrown if an error occurs
decompressionBufferExhaustedback to summary
protected void decompressionBufferExhausted(ByteBuf buffer)

Overrides io.netty.handler.codec.compression.ZlibDecoder.decompressionBufferExhausted.

Doc from io.netty.handler.codec.compression.ZlibDecoder.decompressionBufferExhausted.

Called when the decompression buffer cannot be expanded further. Default implementation is a no-op, but subclasses can override in case they want to do something before the DecompressionException is thrown, such as log the data that was decompressed so far.

Annotations
@Override
isClosedback to summary
public boolean isClosed()

Implements abstract io.netty.handler.codec.compression.ZlibDecoder.isClosed.

Returns true if and only if the end of the compressed stream has been reached.

Annotations
@Override