< Summary

Information
Class: System.IO.Compression.ZstandardCompressionOptions
Assembly: System.IO.Compression
File(s): D:\runner\runtime\src\libraries\System.IO.Compression\src\System\IO\Compression\Zstandard\ZstandardCompressionOptions.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 39
Coverable lines: 39
Total lines: 112
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 6
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%

File(s)

D:\runner\runtime\src\libraries\System.IO.Compression\src\System\IO\Compression\Zstandard\ZstandardCompressionOptions.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
 4namespace System.IO.Compression
 5{
 6    /// <summary>Provides compression options to be used with Zstandard compression.</summary>
 7    [System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
 8    [System.Runtime.Versioning.UnsupportedOSPlatform("wasi")]
 9    public sealed class ZstandardCompressionOptions
 10    {
 11        /// <summary>Gets the default compression quality level.</summary>
 012        public static int DefaultQuality => ZstandardUtils.Quality_Default;
 13
 14        /// <summary>Gets the minimum compression quality level.</summary>
 015        public static int MinQuality => ZstandardUtils.Quality_Min;
 16
 17        /// <summary>Gets the maximum compression quality level.</summary>
 018        public static int MaxQuality => ZstandardUtils.Quality_Max;
 19
 20        /// <summary>Gets the default base-2 logarithm of the window size to use for Zstandard compression.</summary>
 021        public static int DefaultWindowLog2 => ZstandardUtils.WindowLog_Default;
 22
 23        /// <summary>Gets the minimum base-2 logarithm of the window size to use for Zstandard compression.</summary>
 024        public static int MinWindowLog2 => ZstandardUtils.WindowLog_Min;
 25
 26        /// <summary>Gets the maximum base-2 logarithm of the window size to use for Zstandard compression.</summary>
 027        public static int MaxWindowLog2 => ZstandardUtils.WindowLog_Max;
 28
 29        /// <summary>Initializes a new instance of the <see cref="ZstandardCompressionOptions"/> class.</summary>
 030        public ZstandardCompressionOptions()
 031        {
 032        }
 33
 34        /// <summary>Gets or sets the compression quality to use for Zstandard compression.</summary>
 35        /// <value>The compression quality. The valid range is from <see cref="MinQuality"/> to <see cref="MaxQuality"/>
 36        /// <remarks>
 37        /// The compression quality determines the compression ratio and speed.
 38        /// Negative values extend the range of speed versus ratio preferences, where lower levels are faster but provid
 39        /// Value 0 indicates the implementation-defined default quality.
 40        /// Values 1-22 are normal compression levels, with <see cref="DefaultQuality"/> being the default.
 41        /// Values 20-22 require more memory and should be used with caution.
 42        /// </remarks>
 43        /// <exception cref="ArgumentOutOfRangeException">The value is not 0 and is not between <see cref="MinQuality"/>
 44        public int Quality
 45        {
 046            get;
 47            set
 048            {
 049                if (value != 0)
 050                {
 051                    ArgumentOutOfRangeException.ThrowIfGreaterThan(value, ZstandardUtils.Quality_Max, nameof(value));
 052                    ArgumentOutOfRangeException.ThrowIfLessThan(value, ZstandardUtils.Quality_Min, nameof(value));
 053                }
 54
 055                field = value;
 056            }
 57        }
 58
 59        /// <summary>Gets or sets the base-2 logarithm of the window size to use for Zstandard compression.</summary>
 60        /// <value>The base-2 logarithm of the window size for compression.</value>
 61        /// <remarks>
 62        /// The window size determines how much data the compressor can reference for finding matches.
 63        /// Larger window sizes can improve compression ratios for large files but require more memory.
 64        /// The valid range is from <see cref="MinWindowLog2"/> to <see cref="MaxWindowLog2"/>.
 65        /// Value 0 indicates the implementation-defined default window size.
 66        /// </remarks>
 67        /// <exception cref="ArgumentOutOfRangeException">The value is not 0 and is not between <see cref="MinWindowLog2
 68        public int WindowLog2
 69        {
 070            get;
 71            set
 072            {
 073                if (value != 0)
 074                {
 075                    ArgumentOutOfRangeException.ThrowIfLessThan(value, ZstandardUtils.WindowLog_Min, nameof(value));
 076                    ArgumentOutOfRangeException.ThrowIfGreaterThan(value, ZstandardUtils.WindowLog_Max, nameof(value));
 077                }
 78
 079                field = value;
 080            }
 81        }
 82
 83        /// <summary>Gets or sets the dictionary to use for compression. If set, the quality specified during dictionary
 84        /// <value>The compression dictionary, or null if no dictionary is used.</value>
 085        public ZstandardDictionary? Dictionary { get; set; }
 86
 87        /// <summary>Gets or sets a hint for the size of the block sizes that the encoder will output. Smaller size lead
 88        /// <value>The target block size in bytes. Valid range is from 1340 to 131072 (2^17). A value of 0 indicates no 
 89        public int TargetBlockSize
 90        {
 091            get;
 92            set
 093            {
 094                if (value != 0)
 095                {
 096                    ArgumentOutOfRangeException.ThrowIfLessThan(value, ZstandardUtils.TargetBlockSize_Min, nameof(value)
 097                    ArgumentOutOfRangeException.ThrowIfGreaterThan(value, ZstandardUtils.TargetBlockSize_Max, nameof(val
 098                }
 99
 0100                field = value;
 0101            }
 102        }
 103
 104        /// <summary>Gets or sets a value indicating whether a 32-bit checksum will be appended at the end of the compre
 0105        public bool AppendChecksum { get; set; }
 106
 107        /// <summary>Gets or sets a value indicating whether long-distance matching is enabled.</summary>
 108        /// <value><see langword="true"/> if long-distance matching is enabled; otherwise, <see langword="false"/>.</val
 109        /// <remarks>Setting this property to <see langword="true" /> might improve compression ratios for large files a
 0110        public bool EnableLongDistanceMatching { get; set; }
 111    }
 112}