XzArchiveSettings.XzArchiveSettings

XzArchiveSettings()

Initializes a new instance of the XzArchiveSettings class using single LZMA2 compression.

public XzArchiveSettings()

Remarks

Default dictionary in LZMA2 filter size equals to 16 megabyte, default block size equals to 64 megabytes, default checksum type is CRC32.

See Also


XzArchiveSettings(XzFilterSettings[], long, XzCheckType)

Initializes a new instance of the XzArchiveSettings class with custom parameters.

public XzArchiveSettings(XzFilterSettings[] filters, long blockSize, XzCheckType checkType)
ParameterTypeDescription
filtersXzFilterSettings[]Filters (compressors) to be sequentially applied to create XzArchive. It can be either single XzLZMA2FilterSettings or pair of XzBcjX86FilterSettings and XzLZMA2FilterSettings
blockSizeInt64Size xz archive block.
checkTypeXzCheckTypeType of checksum calculation for uncompressed data.

Exceptions

exceptioncondition
ArgumentOutOfRangeExceptionblockSize is negative.
ArgumentNullExceptionfilters is null
ArgumentExceptionfilters has less than one or more than two filter, or last filter is not XzLZMA2FilterSettings.

Examples

using (FileStream xzFile = File.Open("archive.xz", FileMode.Create))
{
    XzLZMA2FilterSettings filter = new XzLZMA2FilterSettings(5242880);
    XzArchiveSettings settings = new XzArchiveSettings(new XzFilterSettings[] {filter}, 10485760, XzCheckType.Crc32);
    using (var archive = new XzArchive(settings))
    {
        archive.SetSource("data.bin");
        archive.Save(xzFile);
     }
}

See Also