LhaArchiveEntry

Inheritance: java.lang.Object

All Implemented Interfaces: com.aspose.zip.IArchiveFileEntry

public class LhaArchiveEntry implements IArchiveFileEntry

Represents single file within Lha archive.

Methods

MethodDescription
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 filesystem by path.
getLastModified()Gets the last modified time of the entry.
getLength()Gets the length of the entry in bytes.
getModificationTime()Gets the last modified time of the entry.
getName()Gets the name of the entry.
getPath()Gets the full path to the entry.
isDirectory()Gets a value indicating whether this entry directory.

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:

ParameterTypeDescription
filejava.io.FileFile for storing decompressed data.

Does nothing for directory entry |

extract(OutputStream destination)

public final void extract(OutputStream destination)

Extracts the entry to the stream provided.

Parameters:

ParameterTypeDescription
destinationjava.io.OutputStreamdestination stream

extract(String path)

public final File extract(String path)

Extracts Lha archive entry to a filesystem 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:

ParameterTypeDescription
pathjava.lang.Stringthe path to the file which will store decompressed data

Returns: java.io.File - java.io.File instance containing extracted data

getLastModified()

public final Date getLastModified()

Gets the last modified time of the entry.

Returns: java.util.Date - the last modified time of the entry

getLength()

public final Long getLength()

Gets the length of the entry in bytes.

Returns: java.lang.Long - the length of the entry in bytes

getModificationTime()

public final Date getModificationTime()

Gets the last modified time of the entry.

Returns: java.util.Date - the last modified time of the entry

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

getPath()

public final String getPath()

Gets the full path to the entry.

Returns: java.lang.String - the full path to the entry

isDirectory()

public final boolean isDirectory()

Gets a value indicating whether this entry directory.

Returns: boolean - a value indicating whether this entry directory.