---
title: "ArjEntryPlain.Extract"
url: "https://reference.aspose.com/zip/net/aspose.zip.arj/arjentryplain/extract/"
product: "Aspose.ZIP for .NET API Reference"
description: "ArjEntryPlain method. Extracts the entry to the filesystem by the path provided"
---

## Extract(string) {#extract}

Extracts the entry to the filesystem by the path provided.

```csharp
public FileInfo Extract(string path)
```

| Parameter | Type | Description |
| --- | --- | --- |
| path | String | The path to destination file. If the file already exists, it will be overwritten. |

### Return Value

The file info of a composed file.

### Exceptions

| exception | condition |
| --- | --- |
| ArgumentNullException | *path* is null or empty. |
| ObjectDisposedException | Thrown if the archive has been disposed. |
| FileNotFoundException | The file is not found. |
| InvalidDataException | Checksum mismatch for headers or data. - or - Archive is corrupted. |
| PathTooLongException | The specified path, file name, or both exceed the system-defined maximum length. |
| NotImplementedException | Entry compressed with method 4. |

## Examples

Extract two entries of rar archive.

```csharp
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

* class [ArjEntryPlain](../)
* namespace [Aspose.Zip.Arj](../../arjentryplain/)
* assembly [Aspose.Zip](../../../)

---

## Extract(FileInfo) {#extract_1}

Extracts ARJ archive entry to a file.

```csharp
public void Extract(FileInfo fileInfo)
```

| Parameter | Type | Description |
| --- | --- | --- |
| fileInfo | FileInfo | FileInfo for storing decompressed data. |

### Exceptions

| exception | condition |
| --- | --- |
| InvalidOperationException | Archive headers and service information were not read. |
| SecurityException | The caller does not have the required permission to open the *fileInfo*. |
| ArgumentException | The file path is empty or contains only white spaces. |
| FileNotFoundException | The file is not found. |
| UnauthorizedAccessException | Path to file is read-only or is a directory. |
| ArgumentNullException | *fileInfo* is null. |
| DirectoryNotFoundException | The specified path is invalid, such as being on an unmapped drive. |
| IOException | The file is already open. |
| OperationCanceledException | In .NET Framework 4.0 and above: Thrown when the extraction is canceled via the provided cancellation token. |
| ObjectDisposedException | Thrown if the archive has been disposed. |
| InvalidDataException | Checksum mismatch for headers or data. - or - Archive is corrupted. |
| NotImplementedException | Entry compressed with method 4. |

## Examples

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

### See Also

* class [ArjEntryPlain](../)
* namespace [Aspose.Zip.Arj](../../arjentryplain/)
* assembly [Aspose.Zip](../../../)

---

## Extract(Stream) {#extract_2}

Extracts the entry to the stream provided.

```csharp
public void Extract(Stream destination)
```

| Parameter | Type | Description |
| --- | --- | --- |
| destination | Stream | Destination stream. Must be writable. |

### Exceptions

| exception | condition |
| --- | --- |
| ArgumentException | *destination* does not support writing. |
| InvalidDataException | Checksum mismatch for headers or data. - or - Archive is corrupted. |
| NotImplementedException | Entry compressed with method 4. |
| OperationCanceledException | In .NET Framework 4.0 and above: Thrown when the extraction is canceled via the provided cancellation token. |
| ObjectDisposedException | Thrown if the archive has been disposed. |

### See Also

* class [ArjEntryPlain](../)
* namespace [Aspose.Zip.Arj](../../arjentryplain/)
* assembly [Aspose.Zip](../../../)


