Extract

LzmaArchive.Extract method (1 of 3)

Extracts lzma archive to a stream.

public void Extract(Stream destination)
ParameterTypeDescription
destinationStreamStream for storing decompressed data.

Exceptions

exceptioncondition
InvalidOperationExceptionArchive headers and service information were not read.
InvalidDataExceptionArchive is corrupted.
ArgumentNullExceptionDestination stream is null.
ArgumentExceptionDestination stream does not support writing.

Examples

using (FileStream sourceLzmaFile = File.Open(sourceFileName, FileMode.Open))
{
   using (FileStream extractedFile = File.Open(extractedFileName, FileMode.Create))
   {
       using (var archive = new LzmaArchive(sourceLzmaFile))
       {
           archive.Extract(extractedFile);
       }
   }
}

See Also


LzmaArchive.Extract method (2 of 3)

Extracts lzma archive to a file.

public void Extract(FileInfo fileInfo)
ParameterTypeDescription
fileInfoFileInfoFileInfo for storing decompressed data.

Exceptions

exceptioncondition
InvalidOperationExceptionArchive headers and service information were not read.
SecurityExceptionThe caller does not have the required permission to open the fileInfo.
ArgumentExceptionFile path is empty or contains only white spaces.
FileNotFoundExceptionThe file is not found.
UnauthorizedAccessExceptionPath to file is read-only or is a directory.
ArgumentNullExceptionfileInfo is null.
DirectoryNotFoundExceptionThe specified path is invalid, such as being on an unmapped drive.
IOExceptionThe file is already open.
InvalidDataExceptionArchive is corrupted.

Examples

using (FileStream lzmaFile = File.Open(sourceFileName, FileMode.Open))
{
    using (var archive = new LzmaArchive(lzmaFile))
    {
        archive.Extract(new FileInfo("extracted.bin"));
    }
}

See Also


LzmaArchive.Extract method (3 of 3)

Extracts lzma archive to a file by path.

public void Extract(string path)
ParameterTypeDescription
pathStringPath to file which will store decompressed data.

Exceptions

exceptioncondition
InvalidOperationExceptionArchive headers and service information were not read.
ArgumentNullExceptionpath is null.
SecurityExceptionThe caller does not have the required permission to access.
ArgumentExceptionThe path is empty, contains only white spaces, or contains invalid characters.
UnauthorizedAccessExceptionAccess to file path is denied.
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.
NotSupportedExceptionFile at path contains a colon (:) in the middle of the string.
InvalidDataExceptionArchive is corrupted.

Examples

using (FileStream lzmaFile = File.Open(sourceFileName, FileMode.Open))
{
    using (var archive = new LzmaArchive(lzmaFile))
    {
        archive.Extract("extracted.bin");
    }
}

See Also