ZArchive.Save

Save(Stream, ZArchiveSaveOptions)

Saves xz archive to the stream provided.

public void Save(Stream output, ZArchiveSaveOptions settings = null)
ParameterTypeDescription
outputStreamDestination stream.
settingsZArchiveSaveOptionsOptional settings for archive composition.

Exceptions

exceptioncondition
ArgumentExceptionoutput does not support seeking.
ArgumentNullExceptionoutput is null.

Remarks

output must be seekable.

Examples

using (FileStream zFile = File.Open("data.bin.z", FileMode.Create))
{
    using (var archive = new ZArchive())
    {
        archive.SetSource("data.bin");
        archive.Save(zFile);
     }
}

See Also


Save(string, ZArchiveSaveOptions)

Saves Z archive to destination file provided.

public void Save(string destinationFileName, ZArchiveSaveOptions settings = null)
ParameterTypeDescription
destinationFileNameString+The path of the archive to be created. If the specified file name points to an existing file, it will be overwritten.
settingsZArchiveSaveOptionsOptional settings for archive composition.

Exceptions

exceptioncondition
ArgumentNullExceptiondestinationFileName is null.
SecurityExceptionThe caller does not have the required permission to access.
ArgumentExceptionThe destinationFileName is empty, contains only white spaces, or contains invalid characters.
UnauthorizedAccessExceptionAccess to file destinationFileName is denied.
PathTooLongExceptionThe specified destinationFileName, 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.
NotSupportedExceptionFile at destinationFileName contains a colon (:) in the middle of the string.

Examples

using (var archive = new ZArchive()) 
{
    archive.SetSource(new FileInfo("data.bin"));
    archive.Save("data.bin.Z");
}

See Also