Class ArjArchive
- java.lang.Object
-
- com.aspose.zip.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 Summary
Constructors Constructor Description ArjArchive(InputStream extractionSource)Initializes a new instance of theArjArchiveclass and composes an entry list can be extracted from the archive.ArjArchive(InputStream extractionSource, ArjLoadOptions loadOptions)Initializes a new instance of theArjArchiveclass and composes an entry list can be extracted from the archive.ArjArchive(String path)Initializes a new instance of theArjArchiveclass and composes an entry list can be extracted from the archive.ArjArchive(String path, ArjLoadOptions loadOptions)Initializes a new instance of theArjArchiveclass and composes an entry list can be extracted from the archive.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidextractToDirectory(String destinationDirectory)Extracts all entries to the specified directory.StringgetCommentary()Gets the commentary.List<ArjEntryPlain>getEntries()Gets entries ofArjEntryPlaintype constituting the ARJ archive.Iterable<IArchiveFileEntry>getFileEntries()Gets entries ofIArchiveFileEntrytype constituting the archive.ArchiveFormatgetFormat()Gets the archive format.StringgetName()Gets the original name.
-
-
-
Constructor Detail
-
ArjArchive
public ArjArchive(InputStream extractionSource)
Initializes a new instance of the
ArjArchiveclass 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-extractionSourceis null.com.aspose.ms.System.ArgumentException- >extractionSourcedoes 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
ArjArchiveclass 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 archiveloadOptions- Options to load existing archive with.- Throws:
com.aspose.ms.System.ArgumentNullException-extractionSourceis null.com.aspose.ms.System.ArgumentException- >extractionSourcedoes 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
ArjArchiveclass 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-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.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
ArjArchiveclass 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 fileloadOptions- Options to load existing archive with.- Throws:
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.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
-
getEntries
public final List<ArjEntryPlain> getEntries()
Gets entries of
ArjEntryPlaintype constituting the ARJ archive.- Returns:
- entries of
ArjEntryPlaintype constituting the ARJ archive.
-
getFileEntries
public final Iterable<IArchiveFileEntry> getFileEntries()
Gets entries of
IArchiveFileEntrytype constituting the archive.- Specified by:
getFileEntriesin interfaceIArchive- Returns:
- entries of
IArchiveFileEntrytype constituting the archive
-
getFormat
public final ArchiveFormat getFormat()
Gets 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:
extractToDirectoryin interfaceIArchive- Parameters:
destinationDirectory- the directory to extract the entries to- Throws:
com.aspose.ms.System.ArgumentNullException- Thrown when thedestinationDirectoryis null.
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceIArchive
-
-