Save

LzmaArchive.Save method (1 of 3)

Saves lzma archive to the stream provided.

public void Save(Stream output)
ParameterTypeDescription
outputStreamDestination stream.

Exceptions

exceptioncondition
ArgumentExceptionoutput does not support seeking.
ArgumentNullExceptionoutput is null.

Remarks

output must be seekable.

Examples

using (FileStream lzmaFile = File.Open("archive.lzma", FileMode.Create))
{
    using (var archive = new LzmaArchive())
    {
        archive.SetSource("data.bin");
        archive.Save(lzmaFile);
     }
}

See Also


LzmaArchive.Save method (2 of 3)

Saves lzma archive to destination file provided.

public void Save(FileInfo destination)
ParameterTypeDescription
destinationFileInfoFileInfo which will be opened as destination stream.

Exceptions

exceptioncondition
SecurityExceptionThe caller does not have the required permission to open the destination.
ArgumentExceptionFile path is empty or contains only white spaces.
FileNotFoundExceptionThe file is not found.
UnauthorizedAccessExceptionPath to file is read-only or is a directory.
ArgumentNullExceptiondestination is null.
DirectoryNotFoundExceptionThe specified path is invalid, such as being on an unmapped drive.
IOExceptionThe file is already open.

Examples

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

See Also


LzmaArchive.Save method (3 of 3)

Saves lzma archive to destination file provided.

public void Save(string destinationFileName)
ParameterTypeDescription
destinationFileNameStringThe path of the archive to be created. If the specified file name points to an existing file, it will be overwritten.

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 LzmaArchive()) 
{
    archive.SetSource(new FileInfo("data.bin"));
    archive.Save("result.lzma");
}

See Also