SaveXzCompressed

TarArchive.SaveXzCompressed method (1 of 2)

Saves archive to the stream with xz compression.

public void SaveXzCompressed(Stream output, TarFormat? format = default, 
    XzArchiveSettings settings = null)
ParameterTypeDescription
outputStreamDestination stream.
formatNullable`1Defines tar header format. Null value will be treated as USTar when possible.
settingsXzArchiveSettingsSet of setting particular xz archive: dictionary size, block size, check type.

Exceptions

exceptioncondition
ArgumentNullExceptionoutput is null.
ArgumentExceptionoutput is not writable.

Remarks

outputThe stream must be writable.

Examples

using (FileStream result = File.OpenWrite("result.tar.xz"))
{
    using (FileStream source = File.Open("data.bin", FileMode.Open, FileAccess.Read))
    {
        using (var archive = new TarArchive())
        {
            archive.CreateEntry("entry.bin", source);
            archive.SaveXzCompressed(result);
        }
    }
}

See Also


TarArchive.SaveXzCompressed method (2 of 2)

Saves archive to the path by path with xz compression.

public void SaveXzCompressed(string path, TarFormat? format = default, 
    XzArchiveSettings settings = null)
ParameterTypeDescription
pathStringThe path of the archive to be created. If the specified file name points to an existing file, it will be overwritten.
formatNullable`1Defines tar header format. Null value will be treated as USTar when possible.
settingsXzArchiveSettingsSet of setting particular xz archive: dictionary size, block size, check type.

Examples

using (FileStream source = File.Open("data.bin", FileMode.Open, FileAccess.Read))
{
    using (var archive = new TarArchive())
    {
        archive.CreateEntry("entry.bin", source);
        archive.SaveXzCompressed("result.tar.xz");
    }
}

See Also