## GetArchive(string) {#getarchive_2}

Detects the archive format and creates the appropriate [`IArchive`](../../iarchive/) object according to the type of archive specified by the given path.

```csharp
public static IArchive GetArchive(string path)
```

| Parameter | Type | Description |
| --- | --- | --- |
| path | String | The path to the archive to be analyzed. |

### Return Value

An [`IArchive`](../../iarchive/) object representing the archive.

### Exceptions

| exception | condition |
| --- | --- |
| ArgumentNullException | *path* is `null`. |
| DirectoryNotFoundException | The specified path is invalid, (for example, it is on an unmapped drive). |
| FileNotFoundException | The file specified in *path* was not found. |
| IOException | An I/O error occurred while opening the file. |
| PathTooLongException | The specified path, file name, or both exceed the system-defined maximum length. |
| UnauthorizedAccessException | *path* specified a directory. -or- The caller does not have the required permission. |

### See Also

* interface [IArchive](../../iarchive/)
* class [ArchiveFactory](../)
* namespace [Aspose.Zip](../../archivefactory/)
* assembly [Aspose.Zip](../../../)

---

## GetArchive(Stream) {#getarchive}

Detects the archive format and creates the appropriate [`IArchive`](../../iarchive/) object according to the type of archive specified by the given stream.

```csharp
public static IArchive GetArchive(Stream stream)
```

| Parameter | Type | Description |
| --- | --- | --- |
| stream | Stream | The stream containing the archive data. It must be seekable. |

### Return Value

An [`IArchive`](../../iarchive/) object representing the archive.

### Exceptions

| exception | condition |
| --- | --- |
| ArgumentException | *stream* is not seekable. |
| ArgumentNullException | *stream* is null. |

### See Also

* interface [IArchive](../../iarchive/)
* class [ArchiveFactory](../)
* namespace [Aspose.Zip](../../archivefactory/)
* assembly [Aspose.Zip](../../../)

---

## GetArchive(Stream, string) {#getarchive_1}

Detects the archive format and creates the appropriate [`IArchive`](../../iarchive/) object according to the type of encrypted archive specified by the given stream.

```csharp
public static IArchive GetArchive(Stream stream, string password)
```

| Parameter | Type | Description |
| --- | --- | --- |
| stream | Stream | The stream containing the archive data. It must be seekable. |
| password | String | Password to decrypt an encrypted archive. |

### Return Value

An [`IArchive`](../../iarchive/) object representing the archive.

### Exceptions

| exception | condition |
| --- | --- |
| ArgumentException | *stream* is not seekable. |
| ArgumentNullException | *stream* is null. |

### See Also

* interface [IArchive](../../iarchive/)
* class [ArchiveFactory](../)
* namespace [Aspose.Zip](../../archivefactory/)
* assembly [Aspose.Zip](../../../)


