Package com.aspose.zip
Class LhaArchiveEntry
- java.lang.Object
-
- com.aspose.zip.LhaArchiveEntry
-
- All Implemented Interfaces:
IArchiveFileEntry
public class LhaArchiveEntry extends Object implements IArchiveFileEntry
Represents a single file within Lha archive.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidextract(File file)Extracts Lha archive entry to a file.voidextract(OutputStream destination)Extracts the entry to the stream provided.Fileextract(String path)Extracts Lha archive entry to a filesystem by path.DategetLastModified()Deprecated.This method will be removed in a future release.LonggetLength()Gets the length of the entry in bytes.DategetModificationTime()Gets the last modified time of the entry.StringgetName()Gets the name of the entry.StringgetPath()Gets the full path to the entry.booleanisDirectory()Gets a value indicating whether this entry is a directory.
-
-
-
Method Detail
-
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.
- Specified by:
getNamein interfaceIArchiveFileEntry- Returns:
- the name of the entry
-
getLength
public final Long getLength()
Gets the length of the entry in bytes.
- Specified by:
getLengthin interfaceIArchiveFileEntry- Returns:
- the length of the entry in bytes
-
isDirectory
public final boolean isDirectory()
Gets a value indicating whether this entry is a directory.
- Returns:
- a value indicating whether this entry is a directory.
-
getLastModified
@Deprecated public final Date getLastModified()
Deprecated.This method will be removed in a future release. Please use getModificationTime() instead.Gets the last modified time of the entry.
- Returns:
- the last modified time of the entry
-
getModificationTime
public final Date getModificationTime()
Gets the last modified time of the entry.
- Returns:
- the last modified time of the entry
-
getPath
public final String getPath()
Gets the full path to the entry.
- Returns:
- the full path to the entry
-
extract
public final File extract(String path)
Extracts Lha archive entry to a filesystem by path.
try (FileInputStream lhaFile = new FileInputStream("archive.lha")) { try (LhaArchive archive = new LhaArchive(lhaFile)) { archive.getEntries().get(0).extract("extracted.bin"); } } catch (IOException ex) { }- Specified by:
extractin interfaceIArchiveFileEntry- Parameters:
path- the path to the file which will store decompressed data- Returns:
Fileinstance containing extracted data- Throws:
com.aspose.ms.System.InvalidOperationException- Archive headers and service information were not read.com.aspose.ms.System.ArgumentNullException-pathis null.com.aspose.ms.System.SecurityException- The caller does not have the required permission to access.com.aspose.ms.System.ArgumentException- Thepathis empty, contains only white spaces, or contains invalid characters.com.aspose.ms.System.IO.PathTooLongException- The specifiedpath, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters.com.aspose.ms.System.NotSupportedException- File atpathcontains a colon (:) in the middle of the string.
-
extract
public final void extract(OutputStream destination)
Extracts the entry to the stream provided.
- Specified by:
extractin interfaceIArchiveFileEntry- Parameters:
destination- destination stream
-
extract
public final void extract(File file)
Extracts Lha archive entry to a file.
try (FileInputStream lhaFile = new FileInputStream("archive.lha")) { try (LhaArchive archive = new LhaArchive(lhaFile)) { archive.getEntries().get(0).extract(new File("extracted.bin")); } } catch (IOException ex) { }- Parameters:
file- File for storing decompressed data.Does nothing for directory entry
- Throws:
com.aspose.ms.System.InvalidOperationException- Archive headers and service information were not read.com.aspose.ms.System.SecurityException- The caller does not have the required permission to open thefile.com.aspose.ms.System.ArgumentException- The file path is empty or contains only white spaces.com.aspose.ms.System.IO.FileNotFoundException- The file is not found.com.aspose.ms.System.ArgumentNullException-fileis null.com.aspose.ms.System.IO.DirectoryNotFoundException- The specified path is invalid, such as being on an unmapped drive.com.aspose.ms.System.IO.IOException- The file is already open.
-
-