TarArchive.SaveLZ4Compressed

SaveLZ4Compressed(Stream, TarFormat?)

Saves archive to the stream with LZ4 compression.

public void SaveLZ4Compressed(Stream output, TarFormat? format = default)
ParameterTypeDescription
outputStreamDestination stream.
formatNullable`1Defines the tar header format. Null value will be treated as USTar when possible.

Exceptions

exceptioncondition
ArgumentNullExceptionoutput is null.
ArgumentExceptionoutput is not writable.
ObjectDisposedExceptionArchive has been disposed and cannot be used

Remarks

output must be writable.

Examples

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

See Also


SaveLZ4Compressed(string, TarFormat?)

Saves archive to the file by path with LZ4 compression.

public void SaveLZ4Compressed(string path, TarFormat? format = default)
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 the tar header format. Null value will be treated as USTar when possible.

Exceptions

exceptioncondition
UnauthorizedAccessExceptionThe caller does not have the required permission. -or- path specified a read-only file or directory.
ArgumentExceptionpath is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
ArgumentNullExceptionpath is null.
PathTooLongExceptionThe specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters.
DirectoryNotFoundExceptionThe specified path is invalid, (for example, it is on an unmapped drive).
NotSupportedExceptionpath is in an invalid format.
ObjectDisposedExceptionArchive has been disposed and cannot be used

Examples

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

See Also