Class ZstdDecoder

    • Field Detail

      • DEFAULT_MAX_FORWARD_BYTES

        private static final int DEFAULT_MAX_FORWARD_BYTES
      • DEFAULT_OUTPUT_BUFFER_SIZE

        static final int DEFAULT_OUTPUT_BUFFER_SIZE
        See Also:
        Constant Field Values
      • 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
      • maxForwardBytes

        private final int maxForwardBytes
      • outputBufferSize

        private final int outputBufferSize
      • maxWindowLog

        private final int maxWindowLog
      • zstdIs

        private com.github.luben.zstd.ZstdInputStreamNoFinalizer zstdIs
      • needsRead

        private boolean needsRead
    • 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.
      • ZstdDecoder

        ZstdDecoder​(int maximumAllocationSize,
                    int maxWindowLog,
                    int defaultMaxForwardBytes)