Class LzxArchiveEntry

    • 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:
        getName in interface IArchiveFileEntry
        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:
        getLength in interface IArchiveFileEntry
        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:
        extract in interface IArchiveFileEntry
        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 - path is null.
        com.aspose.ms.System.SecurityException - The caller does not have the required permission to access.
        com.aspose.ms.System.ArgumentException - The path is empty, contains only white spaces, or contains invalid characters.
        com.aspose.ms.System.IO.PathTooLongException - The specified path, 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 at path contains 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:
        extract in interface IArchiveFileEntry
        Parameters:
        destination - Destination stream. Must be writable.
        Throws:
        com.aspose.ms.System.ArgumentException - destination does 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.