Class ZstdDecoder

  • All Implemented Interfaces:
    io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler

    public final class ZstdDecoder
    extends io.netty.handler.codec.ByteToMessageDecoder
    Decompresses a compressed block ByteBuf using the Zstandard algorithm. See Zstandard.
    • Nested Class Summary

      • Nested classes/interfaces inherited from class io.netty.handler.codec.ByteToMessageDecoder

        io.netty.handler.codec.ByteToMessageDecoder.Cumulator
      • Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler

        io.netty.channel.ChannelHandler.Sharable
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int DEFAULT_MAX_WINDOW_LOG
      Default upper bound on the Window_Log accepted by the decoder.
      static int DEFAULT_MAXIMUM_ALLOCATION_SIZE
      Default maximum size of a single output buffer, in bytes (4 MiB).
      • Fields inherited from class io.netty.handler.codec.ByteToMessageDecoder

        COMPOSITE_CUMULATOR, MERGE_CUMULATOR
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void channelReadComplete​(io.netty.channel.ChannelHandlerContext ctx)  
      protected void decode​(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf in, List<Object> out)  
      void handlerAdded​(io.netty.channel.ChannelHandlerContext ctx)  
      protected void handlerRemoved0​(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
      • 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 the Window_Log accepted by the decoder. 27 corresponds to a 128 MiB decompression window.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ZstdDecoder

        public ZstdDecoder()
        Creates a new decoder with the DEFAULT_MAXIMUM_ALLOCATION_SIZE, and the DEFAULT_MAX_WINDOW_LOG window 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 the DEFAULT_MAX_WINDOW_LOG window 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 accepted Window_Log.
        Parameters:
        maximumAllocationSize - maximum size of a single output buffer.
        maxWindowLog - upper bound on the Window_Log field 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:
        decode in class io.netty.handler.codec.ByteToMessageDecoder
        Throws:
        Exception
      • channelReadComplete

        public void channelReadComplete​(io.netty.channel.ChannelHandlerContext ctx)
                                 throws Exception
        Specified by:
        channelReadComplete in interface io.netty.channel.ChannelInboundHandler
        Overrides:
        channelReadComplete in class io.netty.handler.codec.ByteToMessageDecoder
        Throws:
        Exception
      • handlerAdded

        public void handlerAdded​(io.netty.channel.ChannelHandlerContext ctx)
                          throws Exception
        Specified by:
        handlerAdded in interface io.netty.channel.ChannelHandler
        Overrides:
        handlerAdded in class io.netty.channel.ChannelHandlerAdapter
        Throws:
        Exception
      • handlerRemoved0

        protected void handlerRemoved0​(io.netty.channel.ChannelHandlerContext ctx)
                                throws Exception
        Overrides:
        handlerRemoved0 in class io.netty.handler.codec.ByteToMessageDecoder
        Throws:
        Exception