Class ZstdDecoder
- java.lang.Object
-
- io.netty.channel.ChannelHandlerAdapter
-
- io.netty.channel.ChannelInboundHandlerAdapter
-
- io.netty.handler.codec.ByteToMessageDecoder
-
- io.netty.handler.codec.compression.ZstdDecoder
-
- All Implemented Interfaces:
io.netty.channel.ChannelHandler,io.netty.channel.ChannelInboundHandler
public final class ZstdDecoder extends io.netty.handler.codec.ByteToMessageDecoderDecompresses a compressed blockByteBufusing the Zstandard algorithm. See Zstandard.
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_MAX_WINDOW_LOGDefault upper bound on theWindow_Logaccepted by the decoder.static intDEFAULT_MAXIMUM_ALLOCATION_SIZEDefault maximum size of a single output buffer, in bytes (4 MiB).
-
Constructor Summary
Constructors Constructor Description ZstdDecoder()Creates a new decoder with theDEFAULT_MAXIMUM_ALLOCATION_SIZE, and theDEFAULT_MAX_WINDOW_LOGwindow log size.ZstdDecoder(int maximumAllocationSize)Creates a new decoder with the given maximum allocation size, and theDEFAULT_MAX_WINDOW_LOGwindow log size.ZstdDecoder(int maximumAllocationSize, int maxWindowLog)Creates a new decoder with an explicit upper bound on the acceptedWindow_Log.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidchannelReadComplete(io.netty.channel.ChannelHandlerContext ctx)protected voiddecode(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf in, List<Object> out)voidhandlerAdded(io.netty.channel.ChannelHandlerContext ctx)protected voidhandlerRemoved0(io.netty.channel.ChannelHandlerContext ctx)-
Methods inherited from class io.netty.handler.codec.ByteToMessageDecoder
actualReadableBytes, callDecode, channelInactive, channelRead, decodeLast, discardSomeReadBytes, handlerRemoved, internalBuffer, isSingleDecode, setCumulator, setDiscardAfterReads, setSingleDecode, userEventTriggered
-
-
-
-
Field Detail
-
DEFAULT_MAXIMUM_ALLOCATION_SIZE
public static final int DEFAULT_MAXIMUM_ALLOCATION_SIZE
Default maximum size of a single output buffer, in bytes (4 MiB).- See Also:
- Constant Field Values
-
DEFAULT_MAX_WINDOW_LOG
public static final int DEFAULT_MAX_WINDOW_LOG
Default upper bound on theWindow_Logaccepted by the decoder.27corresponds to a 128 MiB decompression window.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ZstdDecoder
public ZstdDecoder()
Creates a new decoder with theDEFAULT_MAXIMUM_ALLOCATION_SIZE, and theDEFAULT_MAX_WINDOW_LOGwindow log size.The window log size bounds the memory usage of the sliding window for ZSTD frame decompression. Frames declaring a larger window will be rejected to bound the memory the decoder may allocate per stream.
-
ZstdDecoder
public ZstdDecoder(int maximumAllocationSize)
Creates a new decoder with the given maximum allocation size, and theDEFAULT_MAX_WINDOW_LOGwindow log size.The window log size bounds the memory usage of the sliding window for ZSTD frame decompression. Frames declaring a larger window will be rejected to bound the memory the decoder may allocate per stream.
- Parameters:
maximumAllocationSize- maximum size of a single output buffer.
-
ZstdDecoder
public ZstdDecoder(int maximumAllocationSize, int maxWindowLog)Creates a new decoder with an explicit upper bound on the acceptedWindow_Log.- Parameters:
maximumAllocationSize- maximum size of a single output buffer.maxWindowLog- upper bound on theWindow_Logfield of incoming frames; must be in[10, 31]. Frames declaring a larger window will be rejected to bound the memory the decoder may allocate per stream.
-
-
Method Detail
-
decode
protected void decode(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf in, List<Object> out) throws Exception- Specified by:
decodein classio.netty.handler.codec.ByteToMessageDecoder- Throws:
Exception
-
channelReadComplete
public void channelReadComplete(io.netty.channel.ChannelHandlerContext ctx) throws Exception- Specified by:
channelReadCompletein interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelReadCompletein classio.netty.handler.codec.ByteToMessageDecoder- Throws:
Exception
-
handlerAdded
public void handlerAdded(io.netty.channel.ChannelHandlerContext ctx) throws Exception- Specified by:
handlerAddedin interfaceio.netty.channel.ChannelHandler- Overrides:
handlerAddedin classio.netty.channel.ChannelHandlerAdapter- Throws:
Exception
-
-