< Summary

Line coverage
0%
Covered lines: 0
Uncovered lines: 61
Coverable lines: 61
Total lines: 167
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 10
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)

https://raw.githubusercontent.com/dotnet/runtime/811a7eabb75c42db53440e8ba3f60c07511cfd1f/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>Gets the minimum base-2 logarithm of the hash table size to use for Zstandard compression.</summary
 030        public static int MinHashLog2 => ZstandardUtils.HashLog_Min;
 31
 32        /// <summary>Gets the maximum base-2 logarithm of the hash table size to use for Zstandard compression.</summary
 033        public static int MaxHashLog2 => ZstandardUtils.HashLog_Max;
 34
 35        /// <summary>Gets the minimum base-2 logarithm of the chain table size to use for Zstandard compression.</summar
 036        public static int MinChainLog2 => ZstandardUtils.ChainLog_Min;
 37
 38        /// <summary>Gets the maximum base-2 logarithm of the chain table size to use for Zstandard compression.</summar
 039        public static int MaxChainLog2 => ZstandardUtils.ChainLog_Max;
 40
 41        /// <summary>Initializes a new instance of the <see cref="ZstandardCompressionOptions"/> class.</summary>
 042        public ZstandardCompressionOptions()
 043        {
 044        }
 45
 46        /// <summary>Gets or sets the compression quality to use for Zstandard compression.</summary>
 47        /// <value>The compression quality. The valid range is from <see cref="MinQuality"/> to <see cref="MaxQuality"/>
 48        /// <remarks>
 49        /// The compression quality determines the compression ratio and speed.
 50        /// Negative values extend the range of speed versus ratio preferences, where lower levels are faster but provid
 51        /// Value 0 indicates the implementation-defined default quality.
 52        /// Values 1-22 are normal compression levels, with <see cref="DefaultQuality"/> being the default.
 53        /// Values 20-22 require more memory and should be used with caution.
 54        /// </remarks>
 55        /// <exception cref="ArgumentOutOfRangeException">The value is not 0 and is not between <see cref="MinQuality"/>
 56        public int Quality
 57        {
 058            get;
 59            set
 060            {
 061                if (value != 0)
 062                {
 063                    ArgumentOutOfRangeException.ThrowIfGreaterThan(value, ZstandardUtils.Quality_Max, nameof(value));
 064                    ArgumentOutOfRangeException.ThrowIfLessThan(value, ZstandardUtils.Quality_Min, nameof(value));
 065                }
 66
 067                field = value;
 068            }
 69        }
 70
 71        /// <summary>Gets or sets the base-2 logarithm of the window size to use for Zstandard compression.</summary>
 72        /// <value>The base-2 logarithm of the window size for compression.</value>
 73        /// <remarks>
 74        /// The window size determines how much data the compressor can reference for finding matches.
 75        /// Larger window sizes can improve compression ratios for large files but require more memory.
 76        /// The valid range is from <see cref="MinWindowLog2"/> to <see cref="MaxWindowLog2"/>.
 77        /// Value 0 indicates the implementation-defined default window size.
 78        /// </remarks>
 79        /// <exception cref="ArgumentOutOfRangeException">The value is not 0 and is not between <see cref="MinWindowLog2
 80        public int WindowLog2
 81        {
 082            get;
 83            set
 084            {
 085                if (value != 0)
 086                {
 087                    ArgumentOutOfRangeException.ThrowIfLessThan(value, ZstandardUtils.WindowLog_Min, nameof(value));
 088                    ArgumentOutOfRangeException.ThrowIfGreaterThan(value, ZstandardUtils.WindowLog_Max, nameof(value));
 089                }
 90
 091                field = value;
 092            }
 93        }
 94
 95        /// <summary>Gets or sets the dictionary to use for compression. If set, the quality specified during dictionary
 96        /// <value>The compression dictionary, or null if no dictionary is used.</value>
 097        public ZstandardDictionary? Dictionary { get; set; }
 98
 99        /// <summary>Gets or sets a hint for the size of the block sizes that the encoder will output. Smaller size lead
 100        /// <value>The target block size in bytes. Valid range is from 1340 to 131072 (2^17). A value of 0 indicates no 
 101        public int TargetBlockSize
 102        {
 0103            get;
 104            set
 0105            {
 0106                if (value != 0)
 0107                {
 0108                    ArgumentOutOfRangeException.ThrowIfLessThan(value, ZstandardUtils.TargetBlockSize_Min, nameof(value)
 0109                    ArgumentOutOfRangeException.ThrowIfGreaterThan(value, ZstandardUtils.TargetBlockSize_Max, nameof(val
 0110                }
 111
 0112                field = value;
 0113            }
 114        }
 115
 116        /// <summary>Gets or sets a value indicating whether a 32-bit checksum will be appended at the end of the compre
 0117        public bool AppendChecksum { get; set; }
 118
 119        /// <summary>Gets or sets a value indicating whether long-distance matching is enabled.</summary>
 120        /// <value><see langword="true"/> if long-distance matching is enabled; otherwise, <see langword="false"/>.</val
 121        /// <remarks>Setting this property to <see langword="true" /> might improve compression ratios for large files a
 0122        public bool EnableLongDistanceMatching { get; set; }
 123
 124        /// <summary>Gets or sets the base-2 logarithm of the initial probe (hash) table size to use for Zstandard compr
 125        /// <value>The base-2 logarithm of the hash table size. The valid range is from <see cref="MinHashLog2"/> to <se
 126        /// <remarks>
 127        /// Value 0 indicates the implementation-defined default hash table size derived from <see cref="Quality"/>.
 128        /// </remarks>
 129        /// <exception cref="ArgumentOutOfRangeException">The value is not 0 and is not between <see cref="MinHashLog2"/
 130        public int HashLog2
 131        {
 0132            get;
 133            set
 0134            {
 0135                if (value != 0)
 0136                {
 0137                    ArgumentOutOfRangeException.ThrowIfLessThan(value, ZstandardUtils.HashLog_Min, nameof(value));
 0138                    ArgumentOutOfRangeException.ThrowIfGreaterThan(value, ZstandardUtils.HashLog_Max, nameof(value));
 0139                }
 140
 0141                field = value;
 0142            }
 143        }
 144
 145        /// <summary>Gets or sets the base-2 logarithm of the multi-probe search (chain) table size to use for Zstandard
 146        /// <value>The base-2 logarithm of the chain table size. The valid range is from <see cref="MinChainLog2"/> to <
 147        /// <remarks>
 148        /// Value 0 indicates the implementation-defined default chain table size derived from <see cref="Quality"/>.
 149        /// </remarks>
 150        /// <exception cref="ArgumentOutOfRangeException">The value is not 0 and is not between <see cref="MinChainLog2"
 151        public int ChainLog2
 152        {
 0153            get;
 154            set
 0155            {
 0156                if (value != 0)
 0157                {
 0158                    ArgumentOutOfRangeException.ThrowIfLessThan(value, ZstandardUtils.ChainLog_Min, nameof(value));
 0159                    ArgumentOutOfRangeException.ThrowIfGreaterThan(value, ZstandardUtils.ChainLog_Max, nameof(value));
 0160                }
 161
 0162                field = value;
 0163            }
 164        }
 165    }
 166}
 167