Xceed .NET Libraries Documentation
CompressionLevel Enumeration


Xceed.Compression Assembly > Xceed.Compression Namespace : CompressionLevel Enumeration
Represents the amount of compression to be applied when compressing data.
Syntax
'Declaration
 
Public Enum CompressionLevel 

   Inherits System.Enum

   Implements System.IComparableSystem.IConvertibleSystem.IFormattable 
'Usage
 
Dim instance As CompressionLevel
Members
MemberValueDescription
Highest9

Maximum compression. Best compression ratio that the compression algorithm is capable of producing. Compared to the Normal compression level, this level significantly increases compression time for only slightly smaller compressed data. It is recommended to use this setting only when you really need to achieve the smallest possible files and when compression time is not important. Numeric value: 9.

Lowest1Minimum compression. Takes the least amount of time to compress data. Numeric value: 1.
None0No compression is applied. Numeric value: 0.
Normal6

Normal compression. Best balance between the time it takes to compress data and the compression ratio achieved. Numeric value: 6.

Remarks

The compression level only applies to the Deflated, Deflated64, PPMd, and LZMA compression methodsIt does not apply to the BZip2 or BWT compression methods.

The greater the amount of compression applied, the greater the time it takes to perform the compression.

When CompressionLevel.None is used with CompressionMethod.Deflate or CompressionMethod.Deflate64, data will be written in the specified format but no compression will be applied. Since the Deflate format breaks the data down into blocks, it has some overhead. Therefore, compressed data can be slightly larger than uncompressed data. So the correct way to truly disable compression and avoid overhead is to specify CompressionMethod.Stored. The format contains a marker that specifies the end of the data. Components such as Xceed Real-Time Zip for .NET automatically make use of this combination to store uncompressed items without sacrificing the ability to read back the data through a stream.

For all other compression methods, CompressionLevel.None changes the effective method to CompressionMethod.Stored.

When CompressionMethod.BZip2 or CompressionMethod.BWT is used, the compression level value determines the block size to be used for compression: the actual block size is determined by multiplying the numeric value corresponding to the level (see table above) multiplied by 100,000.

CompressionLevel.Highest gives the best compression but takes the most memory.

When CompressionMethod.LZMA is used, the compression level value is passed to the LZMAOptions.SetTemplate method.

Inheritance Hierarchy

System.Object
   System.ValueType
      System.Enum
         Xceed.Compression.CompressionLevel

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

Xceed.Compression Namespace