Rebex
Products Downloads Buy Support Contact
Show / Hide Table of Contents

ZipArchive.ExtractFile Method

Namespace: Rebex.IO.Compression
Assembly: Rebex.Zip.dll (version 7.0.9147)

ExtractFile(String, String)

Extracts the specified archive file item into a local file.

Declaration
public ArchiveOperationResult ExtractFile(string archiveFilePath, string targetPath)
Parameters
Type Name Description
String archiveFilePath

Path to an archive file to be extracted.

String targetPath

Path to a (non-existing) local file or path to a directory ending with directory separator (typically '').

Returns
Type Description
ArchiveOperationResult

Operation result.

Exceptions
Type Condition
ArgumentNullException

The specified path is null.

ArgumentException

The specified path is empty or contains invalid characters. -or- The system could not retrieve the absolute path.

InvalidOperationException

The specified path is not a file.

ObjectDisposedException

Archive was already disposed.

NotSupportedException

Path is in an invalid format.

PathTooLongException

targetPath exceed the maximum length defined by system.

DirectoryNotFoundException

Part of the target path was not found.

SecurityException

The caller does not have the required permissions.

UnauthorizedAccessException

Access to the file is denied.

IOException

Local file already exists or an I/O error occurred.

ZipException

Cannot perform the requested operation, or the operation was canceled (see ProblemType for detailed information).

ExtractFile(String, String, ActionOnExistingFiles)

Extracts the specified archive file item into a local file.

Declaration
public ArchiveOperationResult ExtractFile(string archiveFilePath, string targetPath, ActionOnExistingFiles defaultActionOnExistingFiles)
Parameters
Type Name Description
String archiveFilePath

Path to an archive file to be extracted.

String targetPath

Path to a (non-existing) local file or path to a directory ending with directory separator (typically '').

ActionOnExistingFiles defaultActionOnExistingFiles

Specifies the default behavior for files that already exists in the local directory.

Returns
Type Description
ArchiveOperationResult

Operation result.

Exceptions
Type Condition
ArgumentNullException

The specified path is null.

ArgumentException

The specified path is empty or contains invalid characters. -or- The system could not retrieve the absolute path.

InvalidOperationException

The specified path is not a file.

ObjectDisposedException

Archive was already disposed.

NotSupportedException

Path is in an invalid format.

PathTooLongException

targetPath exceed the maximum length defined by system.

DirectoryNotFoundException

Part of the target path was not found.

SecurityException

The caller does not have the required permissions.

UnauthorizedAccessException

Access to the file is denied.

IOException

An I/O error occurred.

ZipException

Cannot perform the requested operation, or the operation was canceled (see ProblemType for detailed information).

ExtractFile(String, Stream)

Extracts the specified archive file item into a stream.

Declaration
public ArchiveOperationResult ExtractFile(string archiveFilePath, Stream outputStream)
Parameters
Type Name Description
String archiveFilePath

Path to an archive file to be extracted.

Stream outputStream

Stream to write the extracted data to.

Returns
Type Description
ArchiveOperationResult

Operation result.

Remarks

Note that data will be written to the current output stream position.

Exceptions
Type Condition
ArgumentNullException

The specified path or output stream is null.

ArgumentException

The specified path is empty.

InvalidOperationException

The output stream is not writable. -or- The specified path is not a file.

ObjectDisposedException

Archive was already disposed.

IOException

An I/O error occurred.

ZipException

Cannot perform the requested operation, or the operation was canceled (see ProblemType for detailed information).

In This Article
  • ExtractFile(String, String)
  • ExtractFile(String, String, ActionOnExistingFiles)
  • ExtractFile(String, Stream)
© REBEX ČR s.r.o. Back to top
Privacy policy
Manage cookies