ArjEntryPlain.Extract

Extract(string)

Extracts the entry to the filesystem by the path provided.

public FileInfo Extract(string path)
ParameterTypeDescription
pathStringThe path to destination file. If the file already exists, it will be overwritten.

Return Value

The file info of a composed file.

Exceptions

exceptioncondition
ArgumentNullExceptionpath is null or empty.

Examples

Extract two entries of rar archive.

using (FileStream arjFile = File.Open("archive.arj", FileMode.Open))
{
    using (ArjArchive archive = new ArjArchive(arjFile))
    {
        archive.Entries[0].Extract("first.bin");
        archive.Entries[1].Extract("second.bin");
    }
}

See Also


Extract(FileInfo)

Extracts ARJ archive entry 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.
ArgumentExceptionThe file 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.
OperationCanceledExceptionIn .NET Framework 4.0 and above: Thrown when the extraction is canceled via the provided cancellation token.

Examples

using (var arjFile = File.Open(sourceFileName, FileMode.Open))
{
    using (var archive = new ArjArchive(arjFile))
    {
        archive.Entries[0].Extract(new FileInfo("extracted.bin"));
    }
}

See Also


Extract(Stream)

Extracts the entry to the stream provided.

public void Extract(Stream destination)
ParameterTypeDescription
destinationStreamDestination stream. Must be writable.

Exceptions

exceptioncondition
ArgumentExceptiondestination does not support writing.
InvalidDataExceptionChecksum mismatch for headers or data. - or - Archive is corrupted.
NotImplementedExceptionEntry compressed with method 4.
OperationCanceledExceptionIn .NET Framework 4.0 and above: Thrown when the extraction is canceled via the provided cancellation token.

See Also