Package com.aspose.zip
Class ArjEntryPlain
- java.lang.Object
-
- com.aspose.zip.ArjEntryPlain
-
- All Implemented Interfaces:
IArchiveFileEntry
public class ArjEntryPlain extends Object implements IArchiveFileEntry
Represents a single file within ARJ archive.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidextract(File file)Extracts ARJ archive entry to a file.voidextract(OutputStream destination)Extracts the entry to the stream provided.Fileextract(String path)Extracts the entry to the filesystem by the path provided.longgetCompressedSize()Gets the size of the compressed file.LonggetLength()Gets the length of the entry in bytes.StringgetName()Gets name of the entry within the archive.longgetUncompressedSize()Gets size of the original file.
-
-
-
Method Detail
-
getName
public final String getName()
Gets name of the entry within the archive.
- Specified by:
getNamein interfaceIArchiveFileEntry- Returns:
- name of the entry within the archive
-
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
-
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:
extractin interfaceIArchiveFileEntry- 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-pathis 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-Filefor 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 thefile.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-fileis 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:
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 the archive is corrupted.com.aspose.ms.System.NotImplementedException- Entry compressed with method 4.
-
-