Class ArjEntryPlain

    • Method Detail

      • getName

        public final String getName()

        Gets name of the entry within the archive.

        Specified by:
        getName in interface IArchiveFileEntry
        Returns:
        name of the entry within the archive
      • 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
      • getCompressedSize

        public final long getCompressedSize()

        Gets the size of the compressed file.

        Returns:
        the size of the compressed file
      • getUncompressedSize

        public final long getUncompressedSize()

        Gets size of the original file.

        Returns:
        size of the original file
      • extract

        public final File extract​(String path)

        Extracts the entry to the filesystem by the path provided.

        Extract two entries of rar archive.

        
             try (FileInputStream arjFile = new FileInputStream("archive.arj")) {
                 try (ArjArchive archive = new ArjArchive(arjFile)) {
                     archive.getEntries().get(0).extract("first.bin");
                     archive.getEntries().get(1).extract("second.bin");
                 }
             } catch (IOException ex) {
             }
         

        Specified by:
        extract in interface IArchiveFileEntry
        Parameters:
        path - the path to destination file. If the file already exists, it will be overwritten
        Returns:
        the file info of the composed file
        Throws:
        com.aspose.ms.System.ArgumentNullException - path is null or empty.
      • extract

        public final void extract​(File file)

        Extracts ARJ archive entry to a file.

        
             try (FileInputStream arjFile = new FileInputStream("sourceFileName")) {
                 try (ArjArchive archive = new ArjArchive(arjFile)) {
                     archive.getEntries().get(0).extract(new File("extracted.bin"));
                 }
             } catch (IOException ex) {
             }
         

        Parameters:
        file - File for storing decompressed data
        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 the file.
        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 - file is 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.
      • 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 the archive is corrupted.
        com.aspose.ms.System.NotImplementedException - Entry compressed with method 4.