Class LzmaArchiveSettings

Class LzmaArchiveSettings

Namespace: Aspose.Zip.LZMA
Assembly: Aspose.Zip.dll (25.12.0)

Settings for lzma archive.

public class LzmaArchiveSettings

Inheritance

object LzmaArchiveSettings

Inherited Members

object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Remarks

The Lempel–Ziv–Markov chain algorithm (LZMA) is an algorithm used to perform lossless data compression. This algorithm uses a dictionary compression scheme somewhat similar to the LZ77 algorithm and features a high compression ratio and a variable compression-dictionary size.

See more: Lempel–Ziv–Markov chain algorithm

Constructors

LzmaArchiveSettings()

Initializes a new instance of the Aspose.Zip.LZMA.LzmaArchiveSettings class with default dictionary size, equals to 16 megabytes, number of fast bytes equal to 32 and literal context bits equal to 3.

public LzmaArchiveSettings()

Examples

using (LzmaArchive archive = new LzmaArchive(new LzmaArchiveSettings() { DictionarySize = 1048576 })
{
    archive.SetSource("data.bin");
    archive.Save(lzmaFile);
}

Properties

DictionarySize

Dictionary (history buffer) size indicates how many bytes of the recently processed uncompressed data are kept in memory. If not set, will be chosen accordingly to entry size.

public int DictionarySize { get; set; }

Property Value

int

Remarks

The bigger the dictionary, usually the better the compression ratio is - but dictionaries larger than the uncompressed data are a waste of RAM.

The disctionary size of LZMA archive must be either a power of two (2^n) or three times a power of two (3*2^n).

Exceptions

ArgumentOutOfRangeException

The value is too small ot too big.

ArgumentException

The value is not a power of two or three times a power of two.

LiteralContextBits

Gets or sets the number of literal context bits.

public int LiteralContextBits { get; set; }

Property Value

int

Remarks

Literal Context Bits define how many of the most significant bits of the previous uncompressed byte are used to predict the bits of the next literal byte. Must be from 0 to 8.

NumberOfFastBytes

Gets or sets the number of bytes used for fast match searching in the LZMA algorithm.

public int NumberOfFastBytes { get; set; }

Property Value

int

Remarks

A higher value allows the compressor to search longer matches, which can improve the compression ratio slightly but slows down compression.

CompressionProgressed

Raises when a portion of raw stream compressed.

public event EventHandler<ProgressEventArgs> CompressionProgressed

Event Type

EventHandler < ProgressEventArgs >

Examples

lzmaArchiveSettings.CompressionProgressed += (s, e) =&gt; { int percent = (int)((100 * (long)e.ProceededBytes) / entrySourceStream.Length); };

 English