Class ArjArchive

  • All Implemented Interfaces:
    IArchive, AutoCloseable

    public class ArjArchive
    extends Object
    implements IArchive, AutoCloseable

    This class represents an ARJ archive file.

    Only the following compression methods are supported:

    Method Explanation
    0 Uncompressed
    1 Combination of LZ77 and adaptive Huffman coding. Best ratio.
    2 Combination of LZ77 and adaptive Huffman coding.
    3 Combination of LZ77 and adaptive Huffman coding. Best speed.

    • Constructor Detail

      • ArjArchive

        public ArjArchive​(InputStream extractionSource)

        Initializes a new instance of the ArjArchive class and composes an entry list can be extracted from the archive.

        This constructor does not decompress any entry. See ArjEntryPlain.extract(java.io.OutputStream) method for decompressing.

        Parameters:
        extractionSource - the source of the archive
        Throws:
        com.aspose.ms.System.ArgumentNullException - extractionSource is null.
        com.aspose.ms.System.ArgumentException - >extractionSource does not support seeking.
        com.aspose.ms.System.IO.InvalidDataException - Wrong signature for archive or the file is not an ARJ archive.
        com.aspose.ms.System.NotSupportedException - The archive is garbled.
      • ArjArchive

        public ArjArchive​(InputStream extractionSource,
                          ArjLoadOptions loadOptions)

        Initializes a new instance of the ArjArchive class and composes an entry list can be extracted from the archive.

        This constructor does not decompress any entry. See ArjEntryPlain.extract(java.io.OutputStream) method for decompressing.

        Parameters:
        extractionSource - the source of the archive
        loadOptions - Options to load existing archive with.
        Throws:
        com.aspose.ms.System.ArgumentNullException - extractionSource is null.
        com.aspose.ms.System.ArgumentException - >extractionSource does not support seeking.
        com.aspose.ms.System.IO.InvalidDataException - Wrong signature for archive or the file is not an ARJ archive.
        com.aspose.ms.System.NotSupportedException - The archive is garbled.
      • ArjArchive

        public ArjArchive​(String path)

        Initializes a new instance of the ArjArchive class and composes an entry list can be extracted from the archive.

        The following example shows how to extract all the entries to a directory.

        
             try (ArjArchive archive = new ArjArchive("archive.arj")) {
                 archive.extractToDirectory("C:\\extracted");
             } catch (IOException ex) {
             }
         

        This constructor does not unpack any entry. See ArjEntryPlain.extract(java.io.OutputStream) method for decompressing.

        Parameters:
        path - the path to the archive file
        Throws:
        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.FileNotFoundException - The file is not found.
        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.
      • ArjArchive

        public ArjArchive​(String path,
                          ArjLoadOptions loadOptions)

        Initializes a new instance of the ArjArchive class and composes an entry list can be extracted from the archive.

        The following example shows how to extract all the entries to a directory.

        
             try (ArjArchive archive = new ArjArchive("archive.arj")) {
                 archive.extractToDirectory("C:\\extracted");
             } catch (IOException ex) {
             }
         

        This constructor does not unpack any entry. See ArjEntryPlain.extract(java.io.OutputStream) method for decompressing.

        Parameters:
        path - the path to the archive file
        loadOptions - Options to load existing archive with.
        Throws:
        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.FileNotFoundException - The file is not found.
        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.
    • Method Detail

      • getFormat

        public final ArchiveFormat getFormat()

        Gets the archive format.

        Specified by:
        getFormat in interface IArchive
        Returns:
        the archive format
      • getCommentary

        public final String getCommentary()

        Gets the commentary.

        Returns:
        the commentary.
      • getName

        public final String getName()

        Gets the original name.

        Returns:
        the original name.
      • extractToDirectory

        public final void extractToDirectory​(String destinationDirectory)

        Extracts all entries to the specified directory.

        The following example shows how to extract all entries to a directory:

        
             try (ArjArchive archive = new ArjArchive(new FileInputStream("archive.arj"))) {
                 archive.extractToDirectory("C:\\extracted");
             } catch (IOException ex) {
             }
         

        Specified by:
        extractToDirectory in interface IArchive
        Parameters:
        destinationDirectory - the directory to extract the entries to
        Throws:
        com.aspose.ms.System.ArgumentNullException - Thrown when the destinationDirectory is null.