LzxArchive

Inheritance: java.lang.Object

All Implemented Interfaces: com.aspose.zip.IArchive, java.lang.AutoCloseable

public class LzxArchive implements IArchive, AutoCloseable

This class represents a LZX (.lzx) archive file.

Constructors

ConstructorDescription
LzxArchive(InputStream extractionSource)Initializes a new instance of the LzxArchive class and composes an entry list can be extracted from the archive.
LzxArchive(InputStream extractionSource, LzxLoadOptions loadOptions)Initializes a new instance of the LzxArchive class and composes an entry list can be extracted from the archive.
LzxArchive(String path)Initializes a new instance of the LzxArchive class and composes an entry list can be extracted from the archive.
LzxArchive(String path, LzxLoadOptions loadOptions)Initializes a new instance of the LzxArchive class and composes an entry list can be extracted from the archive.

Methods

MethodDescription
close(){@inheritDoc}
extractToDirectory(String destinationDirectory)Extracts all the files and directories in the archive to the directory provided.
getEntries()Gets file entries of LzxArchiveEntry type constituting the archive.
getFileEntries()Gets entries of IArchiveFileEntry type constituting the archive.
getFormat()Gets the archive format.

LzxArchive(InputStream extractionSource)

public LzxArchive(InputStream extractionSource)

Initializes a new instance of the LzxArchive class and composes an entry list can be extracted from the archive.

This constructor does not decompress any entry. See LzxArchiveEntry.extract(OutputStream) method for decompressing.

Parameters:

ParameterTypeDescription
extractionSourcejava.io.InputStreamThe source of the archive.

LzxArchive(InputStream extractionSource, LzxLoadOptions loadOptions)

public LzxArchive(InputStream extractionSource, LzxLoadOptions loadOptions)

Initializes a new instance of the LzxArchive class and composes an entry list can be extracted from the archive.

This constructor does not decompress any entry. See LzxArchiveEntry.extract(OutputStream) method for decompressing.

Parameters:

ParameterTypeDescription
extractionSourcejava.io.InputStreamThe source of the archive.
loadOptionsLzxLoadOptionsOptions to load existing archive with.

LzxArchive(String path)

public LzxArchive(String path)

Initializes a new instance of the LzxArchive class and composes an entry list can be extracted from the archive.

The following example extracts an archive, then decompress first entry to a MemoryStream.

 ByteArrayOutputStream extracted = new ByteArrayOutputStream();
 try (LzxArchive archive = new LzxArchive("sample.lzx")) {
     archive.getEntries().get(0).extract(extracted);
 }

This constructor does not decompress any entry. See [LzxArchiveEntry.extract(OutputStream)](../../com.aspose.zip/lzxarchiveentry\#extract-OutputStream-) method for decompressing.

**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| path | java.lang.String | The fully qualified or the relative path to the archive file. |

### LzxArchive(String path, LzxLoadOptions loadOptions) {#LzxArchive-java.lang.String-com.aspose.zip.LzxLoadOptions-}

public LzxArchive(String path, LzxLoadOptions loadOptions)



Initializes a new instance of the [LzxArchive](../../com.aspose.zip/lzxarchive) class and composes an entry list can be extracted from the archive.

The following example extracts an archive, then decompress first entry to a `MemoryStream`.

     ByteArrayOutputStream extracted = new ByteArrayOutputStream();
     try (LzxArchive archive = new LzxArchive("sample.lzx")) {
         archive.getEntries().get(0).extract(extracted);
     }
 
```

This constructor does not decompress any entry. See [LzxArchiveEntry.extract(OutputStream)](../../com.aspose.zip/lzxarchiveentry\#extract-OutputStream-) method for decompressing.

**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| path | java.lang.String | The fully qualified or the relative path to the archive file. |
| loadOptions | [LzxLoadOptions](../../com.aspose.zip/lzxloadoptions) | Options to load existing archive with. |

### close() {#close--}
```
public void close()
```




### extractToDirectory(String destinationDirectory) {#extractToDirectory-java.lang.String-}
```
public final void extractToDirectory(String destinationDirectory)
```


Extracts all the files and directories in the archive to the directory provided.

```
 try (LzxArchive archive = new LzxArchive("archive.lzx")) {
     archive.extractToDirectory("C:/extracted");
 }



**Parameters:**
| Parameter | Type | Description |
| --- | --- | --- |
| destinationDirectory | java.lang.String | The path to the directory to place the extracted files in.

If the directory does not exist, it will be created. |

### getEntries() {#getEntries--}

public final List getEntries()



Gets file entries of [LzxArchiveEntry](../../com.aspose.zip/lzxarchiveentry) type constituting the archive.

**Returns:**
java.util.List<com.aspose.zip.LzxArchiveEntry> - file entries of [LzxArchiveEntry](../../com.aspose.zip/lzxarchiveentry) type constituting the archive.
### getFileEntries() {#getFileEntries--}

public final Iterable getFileEntries()



Gets entries of [IArchiveFileEntry](../../com.aspose.zip/iarchivefileentry) type constituting the archive.

**Returns:**
java.lang.Iterable<com.aspose.zip.IArchiveFileEntry> - entries of [IArchiveFileEntry](../../com.aspose.zip/iarchivefileentry) type constituting the archive
### getFormat() {#getFormat--}

public final ArchiveFormat getFormat()



Gets the archive format.

**Returns:**
[ArchiveFormat](../../com.aspose.zip/archiveformat) - the archive format