< Summary

Information
Class: System.IO.Compression.ZstandardEncoder
Assembly: System.IO.Compression
File(s): D:\runner\runtime\src\libraries\System.IO.Compression\src\System\IO\Compression\Zstandard\ZstandardEncoder.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 275
Coverable lines: 275
Total lines: 512
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 62
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor()100%110%
.ctor(...)0%220%
.ctor(...)100%110%
.ctor(...)0%440%
.ctor(...)0%220%
.ctor(...)0%14140%
InitializeEncoder()0%220%
Compress(...)0%660%
Flush(...)100%110%
CompressCore(...)0%880%
GetMaxCompressedLength(...)0%440%
TryCompress(...)100%110%
TryCompress(...)100%110%
TryCompress(...)100%110%
TryCompressCore(...)0%880%
Reset()100%110%
SetPrefix(...)0%440%
SetSourceLength(...)0%440%
Dispose()100%110%
EnsureNotDisposed()100%110%
SetQuality(...)0%220%
SetWindowLog(...)0%220%
SetDictionary(...)100%110%
SetParameter(...)100%110%

File(s)

D:\runner\runtime\src\libraries\System.IO.Compression\src\System\IO\Compression\Zstandard\ZstandardEncoder.cs

#LineLine coverage
 1// Licensed to the .NET Foundation under one or more agreements.
 2// The .NET Foundation licenses this file to you under the MIT license.
 3
 4using System.Buffers;
 5using System.Diagnostics;
 6using System.Diagnostics.CodeAnalysis;
 7using System.Runtime.InteropServices;
 8using Microsoft.Win32.SafeHandles;
 9
 10namespace System.IO.Compression
 11{
 12    /// <summary>Provides methods and properties to compress data using Zstandard compression.</summary>
 13    [System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
 14    public sealed class ZstandardEncoder : IDisposable
 15    {
 16        internal SafeZstdCompressHandle _context;
 17        private bool _disposed;
 18
 19        /// <summary>
 20        /// True if we finished compressing the entire input.
 21        /// </summary>
 22        private bool _finished;
 23
 24        /// <summary>Initializes a new instance of the <see cref="ZstandardEncoder"/> class with default settings.</summ
 25        /// <exception cref="IOException">Failed to create the <see cref="ZstandardEncoder"/> instance.</exception>
 026        public ZstandardEncoder()
 027        {
 028            _disposed = false;
 029            InitializeEncoder();
 030        }
 31
 32        /// <summary>Initializes a new instance of the <see cref="ZstandardEncoder"/> class with the specified quality l
 33        /// <param name="quality">The compression quality level.</param>
 34        /// <exception cref="ArgumentOutOfRangeException"><paramref name="quality"/> is not between the minimum and maxi
 35        /// <exception cref="IOException">Failed to create the <see cref="ZstandardEncoder"/> instance.</exception>
 036        public ZstandardEncoder(int quality)
 037        {
 038            _disposed = false;
 039            InitializeEncoder();
 40
 41            try
 042            {
 043                if (quality != 0)
 044                {
 045                    SetQuality(_context, quality);
 046                }
 047            }
 048            catch
 049            {
 050                _context.Dispose();
 051                throw;
 52            }
 053        }
 54
 55        /// <summary>Initializes a new instance of the <see cref="ZstandardEncoder"/> class with the specified dictionar
 56        /// <param name="dictionary">The compression dictionary to use.</param>
 57        /// <exception cref="ArgumentNullException"><paramref name="dictionary"/> is null.</exception>
 58        /// <exception cref="IOException">Failed to create the <see cref="ZstandardEncoder"/> instance.</exception>
 059        public ZstandardEncoder(ZstandardDictionary dictionary)
 060        {
 061            _disposed = false;
 062            InitializeEncoder();
 63
 64            try
 065            {
 066                SetDictionary(dictionary);
 067            }
 068            catch
 069            {
 070                _context.Dispose();
 071                throw;
 72            }
 073        }
 74
 75        /// <summary>Initializes a new instance of the <see cref="ZstandardEncoder"/> class with the specified quality a
 76        /// <param name="quality">The compression quality level.</param>
 77        /// <param name="windowLog2">The base-2 logarithm of the window size for compression.</param>
 78        /// <exception cref="ArgumentOutOfRangeException"><paramref name="quality"/> is not between the minimum and maxi
 79        /// <exception cref="IOException">Failed to create the <see cref="ZstandardEncoder"/> instance.</exception>
 080        public ZstandardEncoder(int quality, int windowLog2)
 081        {
 082            _disposed = false;
 083            InitializeEncoder();
 84
 85            try
 086            {
 087                if (quality != 0)
 088                {
 089                    SetQuality(_context, quality);
 090                }
 091                if (windowLog2 != 0)
 092                {
 093                    SetWindowLog(_context, windowLog2);
 094                }
 095            }
 096            catch
 097            {
 098                _context.Dispose();
 099                throw;
 100            }
 0101        }
 102
 103        /// <summary>Initializes a new instance of the <see cref="ZstandardEncoder"/> class with the specified dictionar
 104        /// <param name="dictionary">The compression dictionary to use.</param>
 105        /// <param name="windowLog2">The base-2 logarithm of the window size for compression.</param>
 106        /// <exception cref="ArgumentNullException"><paramref name="dictionary"/> is null.</exception>
 107        /// <exception cref="ArgumentOutOfRangeException"><paramref name="windowLog2"/> is not between the minimum and m
 108        /// <exception cref="IOException">Failed to create the <see cref="ZstandardEncoder"/> instance.</exception>
 0109        public ZstandardEncoder(ZstandardDictionary dictionary, int windowLog2)
 0110        {
 0111            ArgumentNullException.ThrowIfNull(dictionary);
 112
 0113            _disposed = false;
 0114            InitializeEncoder();
 115
 116            try
 0117            {
 0118                SetDictionary(dictionary);
 119
 0120                if (windowLog2 != 0)
 0121                {
 0122                    SetWindowLog(_context, windowLog2);
 0123                }
 0124            }
 0125            catch
 0126            {
 0127                _context.Dispose();
 0128                throw;
 129            }
 0130        }
 131
 132        /// <summary>Initializes a new instance of the <see cref="ZstandardEncoder"/> class with the specified compressi
 133        /// <param name="compressionOptions">The compression options to use.</param>
 134        /// <exception cref="ArgumentNullException"><paramref name="compressionOptions"/> is null.</exception>
 135        /// <exception cref="ArgumentOutOfRangeException">A parameter from <paramref name="compressionOptions"/> is not 
 136        /// <exception cref="IOException">Failed to create the <see cref="ZstandardEncoder"/> instance.</exception>
 0137        public ZstandardEncoder(ZstandardCompressionOptions compressionOptions)
 0138        {
 0139            ArgumentNullException.ThrowIfNull(compressionOptions);
 140
 0141            _disposed = false;
 0142            InitializeEncoder();
 143
 144            try
 0145            {
 0146                if (compressionOptions.Dictionary is not null)
 0147                {
 0148                    SetDictionary(compressionOptions.Dictionary);
 0149                }
 150                else
 0151                {
 0152                    SetQuality(_context, compressionOptions.Quality);
 0153                }
 154
 0155                if (compressionOptions.WindowLog2 != 0)
 0156                {
 0157                    SetWindowLog(_context, compressionOptions.WindowLog2);
 0158                }
 159
 0160                if (compressionOptions.AppendChecksum)
 0161                {
 0162                    SetParameter(_context, Interop.Zstd.ZstdCParameter.ZSTD_c_checksumFlag, 1);
 0163                }
 164
 0165                if (compressionOptions.EnableLongDistanceMatching)
 0166                {
 0167                    SetParameter(_context, Interop.Zstd.ZstdCParameter.ZSTD_c_enableLongDistanceMatching, 1);
 0168                }
 169
 0170                if (compressionOptions.TargetBlockSize != 0)
 0171                {
 0172                    SetParameter(_context, Interop.Zstd.ZstdCParameter.ZSTD_c_targetCBlockSize, compressionOptions.Targe
 0173                }
 174
 0175                if (compressionOptions.HashLog2 != 0)
 0176                {
 0177                    SetParameter(_context, Interop.Zstd.ZstdCParameter.ZSTD_c_hashLog, compressionOptions.HashLog2);
 0178                }
 179
 0180                if (compressionOptions.ChainLog2 != 0)
 0181                {
 0182                    SetParameter(_context, Interop.Zstd.ZstdCParameter.ZSTD_c_chainLog, compressionOptions.ChainLog2);
 0183                }
 0184            }
 0185            catch
 0186            {
 0187                _context.Dispose();
 0188                throw;
 189            }
 0190        }
 191
 192        [MemberNotNull(nameof(_context))]
 193        private void InitializeEncoder()
 0194        {
 0195            _context = Interop.Zstd.ZSTD_createCCtx();
 0196            if (_context.IsInvalid)
 0197            {
 0198                throw new OutOfMemoryException();
 199            }
 0200        }
 201
 202        /// <summary>Compresses the specified data.</summary>
 203        /// <param name="source">The data to compress.</param>
 204        /// <param name="destination">The buffer to write the compressed data to.</param>
 205        /// <param name="bytesConsumed">When this method returns, contains the number of bytes consumed from the source.
 206        /// <param name="bytesWritten">When this method returns, contains the number of bytes written to the destination
 207        /// <param name="isFinalBlock"><see langword="true" /> if this is the final block of data to compress.</param>
 208        /// <returns>An <see cref="OperationStatus"/> indicating the result of the operation.</returns>
 209        /// <exception cref="ObjectDisposedException">The encoder has been disposed.</exception>
 210        /// <exception cref="IOException">An error occurred during compression.</exception>
 211        public OperationStatus Compress(ReadOnlySpan<byte> source, Span<byte> destination, out int bytesConsumed, out in
 0212        {
 0213            EnsureNotDisposed();
 214
 0215            bytesConsumed = 0;
 0216            bytesWritten = 0;
 217
 0218            if (source.IsEmpty && !isFinalBlock)
 0219            {
 0220                return OperationStatus.Done;
 221            }
 222
 0223            return CompressCore(source, destination, out bytesConsumed, out bytesWritten,
 0224                isFinalBlock ? Interop.Zstd.ZstdEndDirective.ZSTD_e_end : Interop.Zstd.ZstdEndDirective.ZSTD_e_continue)
 0225        }
 226
 227        /// <summary>Flushes any remaining processed data to the destination buffer.</summary>
 228        /// <param name="destination">The buffer to write the flushed data to.</param>
 229        /// <param name="bytesWritten">When this method returns, contains the number of bytes written to the destination
 230        /// <returns>An <see cref="OperationStatus"/> indicating the result of the operation.</returns>
 231        /// <exception cref="ObjectDisposedException">The encoder has been disposed.</exception>
 232        /// <exception cref="IOException">An error occurred during the operation.</exception>
 233        public OperationStatus Flush(Span<byte> destination, out int bytesWritten)
 0234        {
 0235            EnsureNotDisposed();
 236
 0237            return CompressCore(ReadOnlySpan<byte>.Empty, destination, out _, out bytesWritten,
 0238                Interop.Zstd.ZstdEndDirective.ZSTD_e_flush);
 0239        }
 240
 241        private OperationStatus CompressCore(ReadOnlySpan<byte> source, Span<byte> destination,
 242            out int bytesConsumed, out int bytesWritten, Interop.Zstd.ZstdEndDirective endDirective)
 0243        {
 0244            bytesConsumed = 0;
 0245            bytesWritten = 0;
 246
 247            unsafe
 0248            {
 0249                fixed (byte* inBytes = &MemoryMarshal.GetReference(source))
 0250                fixed (byte* outBytes = &MemoryMarshal.GetReference(destination))
 0251                {
 0252                    var input = new Interop.Zstd.ZstdInBuffer
 0253                    {
 0254                        src = inBytes,
 0255                        size = (nuint)source.Length,
 0256                        pos = 0
 0257                    };
 258
 0259                    var output = new Interop.Zstd.ZstdOutBuffer
 0260                    {
 0261                        dst = outBytes,
 0262                        size = (nuint)destination.Length,
 0263                        pos = 0
 0264                    };
 265
 0266                    nuint result = Interop.Zstd.ZSTD_compressStream2(_context, ref output, ref input, endDirective);
 267
 0268                    if (ZstandardUtils.IsError(result, out var error))
 0269                    {
 0270                        if (error == Interop.Zstd.ZSTD_error.srcSize_wrong)
 0271                        {
 0272                            return OperationStatus.InvalidData;
 273                        }
 274
 0275                        ZstandardUtils.Throw(error);
 276                    }
 277
 0278                    bytesConsumed = (int)input.pos;
 0279                    bytesWritten = (int)output.pos;
 280
 0281                    if (input.pos == input.size)
 0282                    {
 0283                        _finished |= endDirective == Interop.Zstd.ZstdEndDirective.ZSTD_e_end;
 284
 0285                        return result == 0 ? OperationStatus.Done : OperationStatus.DestinationTooSmall;
 286                    }
 287                    else
 0288                    {
 0289                        return OperationStatus.DestinationTooSmall;
 290                    }
 291                }
 292            }
 0293        }
 294
 295        /// <summary>Gets the maximum compressed size for the specified input length.</summary>
 296        /// <param name="inputLength">The length of the input data.</param>
 297        /// <returns>The maximum possible compressed size.</returns>
 298        /// <exception cref="ArgumentOutOfRangeException"><paramref name="inputLength"/> is less than 0.</exception>
 299        public static long GetMaxCompressedLength(long inputLength)
 0300        {
 0301            ArgumentOutOfRangeException.ThrowIfNegative(inputLength);
 0302            ArgumentOutOfRangeException.ThrowIfGreaterThan(inputLength, nint.MaxValue);
 303
 0304            nuint result = Interop.Zstd.ZSTD_compressBound((nuint)inputLength);
 0305            if (ZstandardUtils.IsError(result))
 0306            {
 0307                throw new ArgumentOutOfRangeException(nameof(inputLength));
 308            }
 309
 0310            if (result > long.MaxValue)
 0311            {
 0312                throw new ArgumentOutOfRangeException(nameof(inputLength));
 313            }
 314
 0315            return (long)result;
 0316        }
 317
 318        /// <summary>Attempts to compress the specified data.</summary>
 319        /// <param name="source">The data to compress.</param>
 320        /// <param name="destination">The buffer to write the compressed data to.</param>
 321        /// <param name="bytesWritten">When this method returns <see langword="true" />, contains the number of bytes wr
 322        /// <returns><see langword="true" /> on success; <see langword="false" /> if the destination buffer is too small
 323        public static bool TryCompress(ReadOnlySpan<byte> source, Span<byte> destination, out int bytesWritten)
 0324        {
 0325            return TryCompress(source, destination, out bytesWritten, ZstandardUtils.Quality_Default, 0);
 0326        }
 327
 328        /// <summary>Attempts to compress the specified data with the specified quality and window size.</summary>
 329        /// <param name="source">The data to compress.</param>
 330        /// <param name="destination">The buffer to write the compressed data to.</param>
 331        /// <param name="bytesWritten">When this method returns <see langword="true" />, contains the number of bytes wr
 332        /// <param name="quality">The compression quality level.</param>
 333        /// <param name="windowLog2">The base-2 logarithm of the window size for compression.</param>
 334        /// <returns><see langword="true" /> on success; <see langword="false" /> if the destination buffer is too small
 335        /// <exception cref="ArgumentOutOfRangeException"><paramref name="quality"/> or <paramref name="windowLog2"/> is
 336        public static bool TryCompress(ReadOnlySpan<byte> source, Span<byte> destination, out int bytesWritten, int qual
 0337        {
 0338            return TryCompressCore(source, destination, out bytesWritten, quality, windowLog2, null);
 0339        }
 340
 341        /// <summary>Attempts to compress the specified data with the specified dictionary and window size.</summary>
 342        /// <param name="source">The data to compress.</param>
 343        /// <param name="destination">The buffer to write the compressed data to.</param>
 344        /// <param name="bytesWritten">When this method returns <see langword="true" />, contains the number of bytes wr
 345        /// <param name="dictionary">The compression dictionary to use.</param>
 346        /// <param name="windowLog2">The base-2 logarithm of the window size for compression.</param>
 347        /// <returns><see langword="true" /> on success; <see langword="false" /> if the destination buffer is too small
 348        /// <exception cref="ArgumentNullException"><paramref name="dictionary"/> is null.</exception>
 349        /// <exception cref="ArgumentOutOfRangeException"><paramref name="windowLog2"/> is out of the valid range.</exce
 350        public static bool TryCompress(ReadOnlySpan<byte> source, Span<byte> destination, out int bytesWritten, Zstandar
 0351        {
 0352            ArgumentNullException.ThrowIfNull(dictionary);
 0353            return TryCompressCore(source, destination, out bytesWritten, 0, windowLog2, dictionary);
 0354        }
 355
 356        internal static bool TryCompressCore(ReadOnlySpan<byte> source, Span<byte> destination, out int bytesWritten, in
 0357        {
 0358            bytesWritten = 0;
 359
 0360            using SafeZstdCompressHandle ctx = Interop.Zstd.ZSTD_createCCtx();
 0361            if (ctx.IsInvalid)
 0362            {
 0363                throw new OutOfMemoryException();
 364            }
 365
 0366            if (dictionary != null)
 0367            {
 0368                ctx.SetDictionary(dictionary.CompressionDictionary);
 0369            }
 370            else
 0371            {
 0372                SetQuality(ctx, quality);
 0373            }
 374
 0375            if (windowLog2 != 0)
 0376            {
 0377                SetWindowLog(ctx, windowLog2);
 0378            }
 379
 380            unsafe
 0381            {
 0382                fixed (byte* inBytes = &MemoryMarshal.GetReference(source))
 0383                fixed (byte* outBytes = &MemoryMarshal.GetReference(destination))
 0384                {
 0385                    nuint result = Interop.Zstd.ZSTD_compress2(ctx, outBytes, (nuint)destination.Length, inBytes, (nuint
 386
 0387                    if (ZstandardUtils.IsError(result, out var error))
 0388                    {
 0389                        return false;
 390                    }
 391
 0392                    bytesWritten = (int)result;
 0393                    return true;
 394                }
 395            }
 0396        }
 397
 398        /// <summary>Resets the encoder session, allowing reuse for the next compression operation.</summary>
 399        /// <remarks>Clears any prefix and restores the dictionary supplied when the encoder was constructed.</remarks>
 400        /// <exception cref="ObjectDisposedException">The encoder has been disposed.</exception>
 401        /// <exception cref="IOException">Failed to reset the encoder session.</exception>
 402        public void Reset()
 0403        {
 0404            EnsureNotDisposed();
 405
 0406            _finished = false;
 0407            _context.Reset();
 0408        }
 409
 410        /// <summary>References a prefix for the next compression operation.</summary>
 411        /// <remarks>
 412        /// The prefix will be used only for the next compression frame and will be removed when <see cref="Reset"/> is 
 413        /// The prefix replaces any dictionary supplied when the encoder was constructed until <see cref="Reset"/> resto
 414        /// The referenced data must remain valid and unmodified for the duration of the compression operation.
 415        /// When compressing with a prefix larger than ~32 MB at high quality levels, set <see cref="ZstandardCompressio
 416        /// </remarks>
 417        /// <exception cref="ObjectDisposedException">The encoder has been disposed.</exception>
 418        /// <exception cref="InvalidOperationException">The encoder is in an invalid state for setting a prefix.</except
 419        public void SetPrefix(ReadOnlyMemory<byte> prefix)
 0420        {
 0421            EnsureNotDisposed();
 422
 0423            if (_finished)
 0424            {
 0425                throw new InvalidOperationException(SR.ZstandardEncoderDecoder_InvalidState);
 426            }
 427
 0428            nuint result = _context.SetPrefix(prefix);
 429
 0430            if (ZstandardUtils.IsError(result, out var error))
 0431            {
 0432                ZstandardUtils.Throw(error);
 433            }
 0434        }
 435
 436        /// <summary>Sets the length of the uncompressed data for the next compression operation.</summary>
 437        /// <param name="length">The length of the source data in bytes.</param>
 438        /// <remarks>
 439        /// Setting the source length is optional. If set, the information is stored in the header of the compressed dat
 440        /// Calling <see cref="Reset"/> clears the length. The length is validated during compression and if the value i
 441        /// the operation status is <see cref="OperationStatus.InvalidData"/>.
 442        /// </remarks>
 443        /// <exception cref="ArgumentOutOfRangeException"><paramref name="length"/> is negative.</exception>
 444        /// <exception cref="ObjectDisposedException">The encoder has been disposed.</exception>
 445        public void SetSourceLength(long length)
 0446        {
 0447            ArgumentOutOfRangeException.ThrowIfNegative(length);
 448
 0449            EnsureNotDisposed();
 450
 0451            if (_finished)
 0452            {
 0453                throw new InvalidOperationException(SR.ZstandardEncoderDecoder_InvalidState);
 454            }
 455
 0456            if (ZstandardUtils.IsError(Interop.Zstd.ZSTD_CCtx_setPledgedSrcSize(_context, (ulong)length), out var error)
 0457            {
 0458                ZstandardUtils.Throw(error);
 459            }
 0460        }
 461
 462        /// <summary>Releases all resources used by the <see cref="ZstandardEncoder"/>.</summary>
 463        public void Dispose()
 0464        {
 0465            _disposed = true;
 0466            _context.Dispose();
 0467        }
 468
 469        private void EnsureNotDisposed()
 0470        {
 0471            ObjectDisposedException.ThrowIf(_disposed, nameof(ZstandardEncoder));
 0472        }
 473
 474        internal static void SetQuality(SafeZstdCompressHandle handle, int quality)
 0475        {
 0476            if (quality != 0)
 0477            {
 0478                ArgumentOutOfRangeException.ThrowIfLessThan(quality, ZstandardUtils.Quality_Min, nameof(quality));
 0479                ArgumentOutOfRangeException.ThrowIfGreaterThan(quality, ZstandardUtils.Quality_Max, nameof(quality));
 0480            }
 481
 0482            SetParameter(handle, Interop.Zstd.ZstdCParameter.ZSTD_c_compressionLevel, quality);
 0483        }
 484
 485        internal static void SetWindowLog(SafeZstdCompressHandle handle, int windowLog2)
 0486        {
 0487            if (windowLog2 != 0)
 0488            {
 0489                ArgumentOutOfRangeException.ThrowIfLessThan(windowLog2, ZstandardUtils.WindowLog_Min, nameof(windowLog2)
 0490                ArgumentOutOfRangeException.ThrowIfGreaterThan(windowLog2, ZstandardUtils.WindowLog_Max, nameof(windowLo
 0491            }
 492
 0493            SetParameter(handle, Interop.Zstd.ZstdCParameter.ZSTD_c_windowLog, windowLog2);
 0494        }
 495
 496        internal void SetDictionary(ZstandardDictionary dictionary)
 0497        {
 0498            Debug.Assert(_context != null);
 0499            ArgumentNullException.ThrowIfNull(dictionary);
 500
 0501            _context.SetDictionary(dictionary.CompressionDictionary);
 0502        }
 503
 504        internal static void SetParameter(SafeZstdCompressHandle handle, Interop.Zstd.ZstdCParameter parameter, int valu
 0505        {
 0506            Debug.Assert(handle != null);
 507
 0508            nuint result = Interop.Zstd.ZSTD_CCtx_setParameter(handle, parameter, value);
 0509            ZstandardUtils.ThrowIfError(result);
 0510        }
 511    }
 512}

Methods/Properties

.ctor()
.ctor(System.Int32)
.ctor(System.IO.Compression.ZstandardDictionary)
.ctor(System.Int32,System.Int32)
.ctor(System.IO.Compression.ZstandardDictionary,System.Int32)
.ctor(System.IO.Compression.ZstandardCompressionOptions)
InitializeEncoder()
Compress(System.ReadOnlySpan`1<System.Byte>,System.Span`1<System.Byte>,System.Int32&,System.Int32&,System.Boolean)
Flush(System.Span`1<System.Byte>,System.Int32&)
CompressCore(System.ReadOnlySpan`1<System.Byte>,System.Span`1<System.Byte>,System.Int32&,System.Int32&,Interop/Zstd/ZstdEndDirective)
GetMaxCompressedLength(System.Int64)
TryCompress(System.ReadOnlySpan`1<System.Byte>,System.Span`1<System.Byte>,System.Int32&)
TryCompress(System.ReadOnlySpan`1<System.Byte>,System.Span`1<System.Byte>,System.Int32&,System.Int32,System.Int32)
TryCompress(System.ReadOnlySpan`1<System.Byte>,System.Span`1<System.Byte>,System.Int32&,System.IO.Compression.ZstandardDictionary,System.Int32)
TryCompressCore(System.ReadOnlySpan`1<System.Byte>,System.Span`1<System.Byte>,System.Int32&,System.Int32,System.Int32,System.IO.Compression.ZstandardDictionary)
Reset()
SetPrefix(System.ReadOnlyMemory`1<System.Byte>)
SetSourceLength(System.Int64)
Dispose()
EnsureNotDisposed()
SetQuality(Microsoft.Win32.SafeHandles.SafeZstdCompressHandle,System.Int32)
SetWindowLog(Microsoft.Win32.SafeHandles.SafeZstdCompressHandle,System.Int32)
SetDictionary(System.IO.Compression.ZstandardDictionary)
SetParameter(Microsoft.Win32.SafeHandles.SafeZstdCompressHandle,Interop/Zstd/ZstdCParameter,System.Int32)