Exemple #1
0
        public Decompressor(DecompressionOptions options)
        {
            Options = options;
            dctx    = ExternMethods.ZSTD_createDCtx().EnsureZstdSuccess();

            options.ApplyDecompressionParams(dctx);
        }
Exemple #2
0
        public DecompressorStream(Stream stream, DecompressionOptions options)
        {
            InnerStream = stream;
            Options     = options;
            DStream     = ZSTD_createDStream();
            if (options == null || options.Ddict == IntPtr.Zero)
            {
                ZSTD_initDStream(DStream);
            }
            else
            {
                ZSTD_initDStream_usingDDict(DStream, options.Ddict);
            }

            InputBuffer = CreateInputBuffer();
            InitializeInputBufferState();
        }
Exemple #3
0
        public DecompressionStream(Stream stream, DecompressionOptions options, int bufferSize = 0)
        {
            if (stream == null)
            {
                throw new ArgumentNullException(nameof(stream));
            }
            if (!stream.CanRead)
            {
                throw new ArgumentException("Stream is not readable", nameof(stream));
            }
            if (bufferSize < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(bufferSize));
            }

            innerStream = stream;

            dStream = ZSTD_createDStream().EnsureZstdSuccess();
            ZSTD_DCtx_reset(dStream, ZSTD_ResetDirective.ZSTD_reset_session_only).EnsureZstdSuccess();

            if (options != null)
            {
                options.ApplyDecompressionParams(dStream);

                if (options.Ddict != IntPtr.Zero)
                {
                    ZSTD_DCtx_refDDict(dStream, options.Ddict).EnsureZstdSuccess();
                }
            }

            this.bufferSize = bufferSize > 0 ? bufferSize : (int)ZSTD_DStreamInSize().EnsureZstdSuccess();
            inputBuffer     = ArrayPool <byte> .Shared.Rent(this.bufferSize);

#if !(NET45 || NETSTANDARD2_0)
            inputMemory = new Memory <byte>(inputBuffer, 0, this.bufferSize);
#endif
            pos = size = (UIntPtr)this.bufferSize;
        }
Exemple #4
0
 internal Decompressor(ZstdNet.DecompressionOptions options) => Delegate = new(options);
Exemple #5
0
 // Token: 0x06000019 RID: 25 RVA: 0x00002431 File Offset: 0x00000631
 public Decompressor(DecompressionOptions options)
 {
     this.Options = options;
     this.dctx    = ExternMethods.ZSTD_createDCtx().EnsureZstdSuccess();
 }