Package com.aspose.zip
Class LzxArchiveEntry
- java.lang.Object
-
- com.aspose.zip.LzxArchiveEntry
-
- All Implemented Interfaces:
IArchiveFileEntry
public class LzxArchiveEntry extends Object implements IArchiveFileEntry
Represents a single file within LZX archive.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidextract(OutputStream destination)Extracts the entry to the stream provided.Fileextract(String path)Extracts Lzx archive entry to a filesystem by path.StringgetCommentary()Gets the commentary.longgetCompressedSize()Gets size of the compressed file.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.longgetUncompressedSize()Gets size of the original file.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
-
getCommentary
public final String getCommentary()
Gets the commentary.
- Returns:
- the commentary.
-
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
-
getUncompressedSize
public final long getUncompressedSize()
Gets size of the original file.
- Returns:
- size of the original file.
-
getCompressedSize
public final long getCompressedSize()
Gets size of the compressed file.
- Returns:
- size of the compressed file.
-
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.
-
getModificationTime
public final Date getModificationTime()
Gets the last modified time of the entry.
- Returns:
- the last modified time of the entry.
-
extract
public final File extract(String path)
Extracts Lzx archive entry to a filesystem by path.
try (FileInputStream lzxFile = new FileInputStream("archive.lzx")) { try (LzxArchive archive = new LzxArchive(lzxFile)) { archive.getEntries().get(0).extract("extracted.bin"); } } catch (IOException ex) { }- Specified by:
extractin interfaceIArchiveFileEntry- Parameters:
path- Path to file which will store decompressed data.- Returns:
FileSystemInfoInstance 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.com.aspose.ms.System.IO.InvalidDataException- Checksum mismatch for headers or data. - or - Archive is corrupted.com.aspose.ms.System.OperationCanceledException- Thrown when the extraction is canceled via the provided cancellation token.com.aspose.ms.System.NotSupportedException- Invalid compression method.
-
extract
public final void extract(OutputStream destination)
Extracts the entry to the stream provided.
- Specified by:
extractin interfaceIArchiveFileEntry- Parameters:
destination- Destination stream. Must be writable.- Throws:
com.aspose.ms.System.ArgumentException-destinationdoes not support writing.com.aspose.ms.System.IO.InvalidDataException- Checksum mismatch for headers or data. - or - Archive is corrupted.com.aspose.ms.System.ArgumentNullException- Destination stream is null.com.aspose.ms.System.NotSupportedException- Invalid compression method.com.aspose.ms.System.OperationCanceledException- Thrown when the extraction is canceled via the provided cancellation token.
-
-