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

public abstract Class ZlibDecoder

extends ByteToMessageDecoder
Class Inheritance
Known Direct Subclasses
io.netty.handler.codec.compression.JdkZlibDecoder, io.netty.handler.codec.compression.JZlibDecoder
Static Imports
io.netty.util.internal.ObjectUtil.checkPositiveOrZero

Decompresses a ByteBuf using the deflate algorithm.

Field Summary

Modifier and TypeField and Description
protected final int
maxAllocation

Maximum allowed size of the decompression buffer.

Inherited from io.netty.handler.codec.ByteToMessageDecoder:
COMPOSITE_CUMULATORMERGE_CUMULATOR

Constructor Summary

AccessConstructor and Description
public
ZlibDecoder()

Same as ZlibDecoder(int) with maxAllocation = 0.

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

Construct a new ZlibDecoder.

Method Summary

Modifier and TypeMethod and Description
protected void
decompressionBufferExhausted(ByteBuf buffer)

Called when the decompression buffer cannot be expanded further.

public abstract boolean
isClosed()

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

protected ByteBuf
prepareDecompressBuffer(ChannelHandlerContext ctx, ByteBuf buffer, int preferredSize)

Allocate or expand the decompression buffer, without exceeding the maximum allocation.

Inherited from io.netty.handler.codec.ByteToMessageDecoder:
actualReadableBytescallDecodechannelInactivechannelReadchannelReadCompletedecodedecodeLastdiscardSomeReadByteshandlerRemovedhandlerRemoved0internalBufferisSingleDecodesetCumulatorsetDiscardAfterReadssetSingleDecodeuserEventTriggered

Field Detail

maxAllocationback to summary
protected final int maxAllocation

Maximum allowed size of the decompression buffer.

Constructor Detail

ZlibDecoderback to summary
public ZlibDecoder()

Same as ZlibDecoder(int) with maxAllocation = 0.

ZlibDecoderback to summary
public ZlibDecoder(int maxAllocation)

Construct a new ZlibDecoder.

Parameters
maxAllocation:int

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

Method Detail

decompressionBufferExhaustedback to summary
protected void decompressionBufferExhausted(ByteBuf buffer)

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.

isClosedback to summary
public abstract boolean isClosed()

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

prepareDecompressBufferback to summary
protected ByteBuf prepareDecompressBuffer(ChannelHandlerContext ctx, ByteBuf buffer, int preferredSize)

Allocate or expand the decompression buffer, without exceeding the maximum allocation. Calls decompressionBufferExhausted(ByteBuf) if the buffer is full and cannot be expanded further.