< 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: 61
Coverable lines: 61
Total lines: 165
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)

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    public sealed class ZstandardCompressionOptions
 9    {
 10        /// <summary>Gets the default compression quality level.</summary>
 011        public static int DefaultQuality => ZstandardUtils.Quality_Default;
 12
 13        /// <summary>Gets the minimum compression quality level.</summary>
 014        public static int MinQuality => ZstandardUtils.Quality_Min;
 15
 16        /// <summary>Gets the maximum compression quality level.</summary>
 017        public static int MaxQuality => ZstandardUtils.Quality_Max;
 18
 19        /// <summary>Gets the default base-2 logarithm of the window size to use for Zstandard compression.</summary>
 020        public static int DefaultWindowLog2 => ZstandardUtils.WindowLog_Default;
 21
 22        /// <summary>Gets the minimum base-2 logarithm of the window size to use for Zstandard compression.</summary>
 023        public static int MinWindowLog2 => ZstandardUtils.WindowLog_Min;
 24
 25        /// <summary>Gets the maximum base-2 logarithm of the window size to use for Zstandard compression.</summary>
 026        public static int MaxWindowLog2 => ZstandardUtils.WindowLog_Max;
 27
 28        /// <summary>Gets the minimum base-2 logarithm of the hash table size to use for Zstandard compression.</summary
 029        public static int MinHashLog2 => ZstandardUtils.HashLog_Min;
 30
 31        /// <summary>Gets the maximum base-2 logarithm of the hash table size to use for Zstandard compression.</summary
 032        public static int MaxHashLog2 => ZstandardUtils.HashLog_Max;
 33
 34        /// <summary>Gets the minimum base-2 logarithm of the chain table size to use for Zstandard compression.</summar
 035        public static int MinChainLog2 => ZstandardUtils.ChainLog_Min;
 36
 37        /// <summary>Gets the maximum base-2 logarithm of the chain table size to use for Zstandard compression.</summar
 038        public static int MaxChainLog2 => ZstandardUtils.ChainLog_Max;
 39
 40        /// <summary>Initializes a new instance of the <see cref="ZstandardCompressionOptions"/> class.</summary>
 041        public ZstandardCompressionOptions()
 042        {
 043        }
 44
 45        /// <summary>Gets or sets the compression quality to use for Zstandard compression.</summary>
 46        /// <value>The compression quality. The valid range is from <see cref="MinQuality"/> to <see cref="MaxQuality"/>
 47        /// <remarks>
 48        /// The compression quality determines the compression ratio and speed.
 49        /// Negative values extend the range of speed versus ratio preferences, where lower levels are faster but provid
 50        /// Value 0 indicates the implementation-defined default quality.
 51        /// Values 1-22 are normal compression levels, with <see cref="DefaultQuality"/> being the default.
 52        /// Values 20-22 require more memory and should be used with caution.
 53        /// </remarks>
 54        /// <exception cref="ArgumentOutOfRangeException">The value is not 0 and is not between <see cref="MinQuality"/>
 55        public int Quality
 56        {
 057            get;
 58            set
 059            {
 060                if (value != 0)
 061                {
 062                    ArgumentOutOfRangeException.ThrowIfGreaterThan(value, ZstandardUtils.Quality_Max, nameof(value));
 063                    ArgumentOutOfRangeException.ThrowIfLessThan(value, ZstandardUtils.Quality_Min, nameof(value));
 064                }
 65
 066                field = value;
 067            }
 68        }
 69
 70        /// <summary>Gets or sets the base-2 logarithm of the window size to use for Zstandard compression.</summary>
 71        /// <value>The base-2 logarithm of the window size for compression.</value>
 72        /// <remarks>
 73        /// The window size determines how much data the compressor can reference for finding matches.
 74        /// Larger window sizes can improve compression ratios for large files but require more memory.
 75        /// The valid range is from <see cref="MinWindowLog2"/> to <see cref="MaxWindowLog2"/>.
 76        /// Value 0 indicates the implementation-defined default window size.
 77        /// </remarks>
 78        /// <exception cref="ArgumentOutOfRangeException">The value is not 0 and is not between <see cref="MinWindowLog2
 79        public int WindowLog2
 80        {
 081            get;
 82            set
 083            {
 084                if (value != 0)
 085                {
 086                    ArgumentOutOfRangeException.ThrowIfLessThan(value, ZstandardUtils.WindowLog_Min, nameof(value));
 087                    ArgumentOutOfRangeException.ThrowIfGreaterThan(value, ZstandardUtils.WindowLog_Max, nameof(value));
 088                }
 89
 090                field = value;
 091            }
 92        }
 93
 94        /// <summary>Gets or sets the dictionary to use for compression. If set, the quality specified during dictionary
 95        /// <value>The compression dictionary, or null if no dictionary is used.</value>
 096        public ZstandardDictionary? Dictionary { get; set; }
 97
 98        /// <summary>Gets or sets a hint for the size of the block sizes that the encoder will output. Smaller size lead
 99        /// <value>The target block size in bytes. Valid range is from 1340 to 131072 (2^17). A value of 0 indicates no 
 100        public int TargetBlockSize
 101        {
 0102            get;
 103            set
 0104            {
 0105                if (value != 0)
 0106                {
 0107                    ArgumentOutOfRangeException.ThrowIfLessThan(value, ZstandardUtils.TargetBlockSize_Min, nameof(value)
 0108                    ArgumentOutOfRangeException.ThrowIfGreaterThan(value, ZstandardUtils.TargetBlockSize_Max, nameof(val
 0109                }
 110
 0111                field = value;
 0112            }
 113        }
 114
 115        /// <summary>Gets or sets a value indicating whether a 32-bit checksum will be appended at the end of the compre
 0116        public bool AppendChecksum { get; set; }
 117
 118        /// <summary>Gets or sets a value indicating whether long-distance matching is enabled.</summary>
 119        /// <value><see langword="true"/> if long-distance matching is enabled; otherwise, <see langword="false"/>.</val
 120        /// <remarks>Setting this property to <see langword="true" /> might improve compression ratios for large files a
 0121        public bool EnableLongDistanceMatching { get; set; }
 122
 123        /// <summary>Gets or sets the base-2 logarithm of the initial probe (hash) table size to use for Zstandard compr
 124        /// <value>The base-2 logarithm of the hash table size. The valid range is from <see cref="MinHashLog2"/> to <se
 125        /// <remarks>
 126        /// Value 0 indicates the implementation-defined default hash table size derived from <see cref="Quality"/>.
 127        /// </remarks>
 128        /// <exception cref="ArgumentOutOfRangeException">The value is not 0 and is not between <see cref="MinHashLog2"/
 129        public int HashLog2
 130        {
 0131            get;
 132            set
 0133            {
 0134                if (value != 0)
 0135                {
 0136                    ArgumentOutOfRangeException.ThrowIfLessThan(value, ZstandardUtils.HashLog_Min, nameof(value));
 0137                    ArgumentOutOfRangeException.ThrowIfGreaterThan(value, ZstandardUtils.HashLog_Max, nameof(value));
 0138                }
 139
 0140                field = value;
 0141            }
 142        }
 143
 144        /// <summary>Gets or sets the base-2 logarithm of the multi-probe search (chain) table size to use for Zstandard
 145        /// <value>The base-2 logarithm of the chain table size. The valid range is from <see cref="MinChainLog2"/> to <
 146        /// <remarks>
 147        /// Value 0 indicates the implementation-defined default chain table size derived from <see cref="Quality"/>.
 148        /// </remarks>
 149        /// <exception cref="ArgumentOutOfRangeException">The value is not 0 and is not between <see cref="MinChainLog2"
 150        public int ChainLog2
 151        {
 0152            get;
 153            set
 0154            {
 0155                if (value != 0)
 0156                {
 0157                    ArgumentOutOfRangeException.ThrowIfLessThan(value, ZstandardUtils.ChainLog_Min, nameof(value));
 0158                    ArgumentOutOfRangeException.ThrowIfGreaterThan(value, ZstandardUtils.ChainLog_Max, nameof(value));
 0159                }
 160
 0161                field = value;
 0162            }
 163        }
 164    }
 165}