LzxArchive
Inheritance: java.lang.Object
All Implemented Interfaces: com.aspose.zip.IArchive, java.lang.AutoCloseable
public class LzxArchive implements IArchive, AutoCloseable
Denna klass representerar en LZX (.lzx)-arkivfil.
Konstruktörer
| Konstruktor | Beskrivning |
|---|---|
| LzxArchive(InputStream extractionSource) | Initierar en ny instans av klassen LzxArchive och skapar en postlista som kan extraheras från arkivet. |
| LzxArchive(InputStream extractionSource, LzxLoadOptions loadOptions) | Initierar en ny instans av klassen LzxArchive och skapar en postlista som kan extraheras från arkivet. |
| LzxArchive(String path) | Initierar en ny instans av klassen LzxArchive och skapar en postlista som kan extraheras från arkivet. |
| LzxArchive(String path, LzxLoadOptions loadOptions) | Initierar en ny instans av klassen LzxArchive och skapar en postlista som kan extraheras från arkivet. |
Metoder
| Metod | Beskrivning |
|---|---|
| close() | {@inheritDoc} |
| extractToDirectory(String destinationDirectory) | Extraherar alla filer och kataloger i arkivet till den angivna katalogen. |
| getEntries() | Hämtar filposter av typen LzxArchiveEntry som utgör arkivet. |
| getFileEntries() | Hämtar poster av typen IArchiveFileEntry som utgör arkivet. |
| getFormat() | Hämtar arkivformatet. |
LzxArchive(InputStream extractionSource)
public LzxArchive(InputStream extractionSource)
Initierar en ny instans av klassen LzxArchive och skapar en postlista som kan extraheras från arkivet.
Denna konstruktor dekomprimerar ingen post. Se metoden LzxArchiveEntry.extract(OutputStream) för dekomprimering.
Parameters:
| Parameter | Typ | Beskrivning |
|---|---|---|
| extractionSource | java.io.InputStream | Källan till arkivet. |
LzxArchive(InputStream extractionSource, LzxLoadOptions loadOptions)
public LzxArchive(InputStream extractionSource, LzxLoadOptions loadOptions)
Initierar en ny instans av klassen LzxArchive och skapar en postlista som kan extraheras från arkivet.
Denna konstruktor dekomprimerar ingen post. Se metoden LzxArchiveEntry.extract(OutputStream) för dekomprimering.
Parameters:
| Parameter | Typ | Beskrivning |
|---|---|---|
| extractionSource | java.io.InputStream | Källan till arkivet. |
| loadOptions | LzxLoadOptions | Alternativ för att läsa in befintligt arkiv med. |
LzxArchive(String path)
public LzxArchive(String path)
Initierar en ny instans av klassen LzxArchive och skapar en postlista som kan extraheras från arkivet.
Följande exempel extraherar ett arkiv och dekomprimerar sedan den första posten till en 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);
}
```
Denna konstruktor dekomprimerar ingen post. Se metoden [LzxArchiveEntry.extract(OutputStream)](../../com.aspose.zip/lzxarchiveentry\#extract-OutputStream-) för dekomprimering.
**Parameters:**
| Parameter | Typ | Beskrivning |
| --- | --- | --- |
| path | java.lang.String | Den fullständiga eller relativa sökvägen till arkivfilen. |
| loadOptions | [LzxLoadOptions](../../com.aspose.zip/lzxloadoptions) | Alternativ för att läsa in befintligt arkiv med. |
### close() {#close--}
```
public void close()
```
### extractToDirectory(String destinationDirectory) {#extractToDirectory-java.lang.String-}
```
public final void extractToDirectory(String destinationDirectory)
```
Extraherar alla filer och kataloger i arkivet till den angivna katalogen.
```
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
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
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