LhaArchiveEntry
Inheritance: java.lang.Object
All Implemented Interfaces: com.aspose.zip.IArchiveFileEntry
public class LhaArchiveEntry implements IArchiveFileEntry
Represents single file within Lha archive.
Methods
Method | Description |
---|---|
extract(File file) | Extracts Lha archive entry to a file. |
extract(OutputStream destination) | Extracts the entry to the stream provided. |
extract(String path) | Extracts Lha archive entry to a file by path. |
getLength() | Gets the length of the entry in bytes. |
getName() | Gets the name of the entry. |
extract(File file)
public final void extract(File file)
Extracts Lha archive entry to a file.
try (FileInputStream lhaFile = new FileInputStream("archive.lzh")) {
try (LhaArchive archive = new LhaArchive(lhaFile)) {
archive.getEntries().get(0).extract(new File("extracted.bin"));
}
} catch (IOException ex) {
}
Parameters:
Parameter | Type | Description |
---|---|---|
file | java.io.File | File for storing decompressed data |
extract(OutputStream destination)
public final void extract(OutputStream destination)
Extracts the entry to the stream provided.
Parameters:
Parameter | Type | Description |
---|---|---|
destination | java.io.OutputStream | destination stream |
extract(String path)
public final File extract(String path)
Extracts Lha archive entry to a file by path.
try (FileInputStream lhaFile = new FileInputStream("archive.lzh")) {
try (LhaArchive archive = new LhaArchive(lhaFile)) {
archive.getEntries().get(0).extract("extracted.bin");
}
} catch (IOException ex) {
}
Parameters:
Parameter | Type | Description |
---|---|---|
path | java.lang.String | the path to the file which will store decompressed data |
Returns: java.io.File - java.io.File instance containing extracted data
getLength()
public final Long getLength()
Gets the length of the entry in bytes.
Returns: java.lang.Long - the length of the entry in bytes
getName()
public final String getName()
Gets the name of the entry.
Archives for compression only, such as gzip, bzip2, lzip, lzma, xz, z has name “File.bin” unless another name can be found in headers.
Returns: java.lang.String - the name of the entry