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
Constructor | Description |
---|---|
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
Method | Description |
---|---|
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:
Parameter | Type | Description |
---|---|---|
extractionSource | java.io.InputStream | The 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:
Parameter | Type | Description |
---|---|---|
extractionSource | java.io.InputStream | The source of the archive. |
loadOptions | LzxLoadOptions | Options 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) 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)
public LzxArchive(String path, LzxLoadOptions loadOptions)
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) method for decompressing.
Parameters:
Parameter | Type | Description |
---|---|---|
path | java.lang.String | The fully qualified or the relative path to the archive file. |
loadOptions | LzxLoadOptions | Options to load existing archive with. |
close()
public void close()
extractToDirectory(String destinationDirectory)
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()
public final List<LzxArchiveEntry> getEntries()
Gets file entries of LzxArchiveEntry type constituting the archive.
Returns: java.util.List<com.aspose.zip.LzxArchiveEntry> - file entries of LzxArchiveEntry type constituting the archive.
getFileEntries()
public final Iterable<IArchiveFileEntry> getFileEntries()
Gets entries of IArchiveFileEntry type constituting the archive.
Returns: java.lang.Iterable<com.aspose.zip.IArchiveFileEntry> - entries of IArchiveFileEntry type constituting the archive
getFormat()
public final ArchiveFormat getFormat()
Gets the archive format.
Returns: ArchiveFormat - the archive format