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:
ChannelHandler,ChannelInboundHandler
public final class ZstdDecoder extends ByteToMessageDecoder
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class io.netty.handler.codec.ByteToMessageDecoder
ByteToMessageDecoder.Cumulator
-
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
ChannelHandler.Sharable
-
-
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).-
Fields inherited from class io.netty.handler.codec.ByteToMessageDecoder
COMPOSITE_CUMULATOR, MERGE_CUMULATOR
-
-
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(ChannelHandlerContext ctx)CallsChannelHandlerContext.fireChannelReadComplete()to forward to the nextChannelInboundHandlerin theChannelPipeline.protected voiddecode(ChannelHandlerContext ctx, ByteBuf in, java.util.List<java.lang.Object> out)Decode the from oneByteBufto an other.voidhandlerAdded(ChannelHandlerContext ctx)Do nothing by default, sub-classes may override this method.protected voidhandlerRemoved0(ChannelHandlerContext ctx)Gets called after theByteToMessageDecoderwas removed from the actual context and it doesn't handle events anymore.-
Methods inherited from class io.netty.handler.codec.ByteToMessageDecoder
actualReadableBytes, callDecode, channelInactive, channelRead, decodeLast, discardSomeReadBytes, handlerRemoved, internalBuffer, isSingleDecode, setCumulator, setDiscardAfterReads, setSingleDecode, userEventTriggered
-
Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught
-
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, isSharable
-
-
-
-
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(ChannelHandlerContext ctx, ByteBuf in, java.util.List<java.lang.Object> out) throws java.lang.Exception
Description copied from class:ByteToMessageDecoderDecode the from oneByteBufto an other. This method will be called till either the inputByteBufhas nothing to read when return from this method or till nothing was read from the inputByteBuf.- Specified by:
decodein classByteToMessageDecoder- Parameters:
ctx- theChannelHandlerContextwhich thisByteToMessageDecoderbelongs toin- theByteBuffrom which to read dataout- theListto which decoded messages should be added- Throws:
java.lang.Exception- is thrown if an error occurs
-
channelReadComplete
public void channelReadComplete(ChannelHandlerContext ctx) throws java.lang.Exception
Description copied from class:ChannelInboundHandlerAdapterCallsChannelHandlerContext.fireChannelReadComplete()to forward to the nextChannelInboundHandlerin theChannelPipeline. Sub-classes may override this method to change behavior.- Specified by:
channelReadCompletein interfaceChannelInboundHandler- Overrides:
channelReadCompletein classByteToMessageDecoder- Throws:
java.lang.Exception
-
handlerAdded
public void handlerAdded(ChannelHandlerContext ctx) throws java.lang.Exception
Description copied from class:ChannelHandlerAdapterDo nothing by default, sub-classes may override this method.- Specified by:
handlerAddedin interfaceChannelHandler- Overrides:
handlerAddedin classChannelHandlerAdapter- Throws:
java.lang.Exception
-
handlerRemoved0
protected void handlerRemoved0(ChannelHandlerContext ctx) throws java.lang.Exception
Description copied from class:ByteToMessageDecoderGets called after theByteToMessageDecoderwas removed from the actual context and it doesn't handle events anymore.- Overrides:
handlerRemoved0in classByteToMessageDecoder- Throws:
java.lang.Exception
-
-