Skip to content
This repository has been archived by the owner on Jul 21, 2020. It is now read-only.

com.github.junrar.Archive

SeregaMamonT edited this page Jan 22, 2013 · 4 revisions

Description

Archive represents RAR archive. It is the main class of the library - it contains main logic of unpacking.

Methods

Constructors
  • Archive(VolumeManager volumeManager) throws RarException, IOException - creates Archive to unpack volumes stored in volumeManager
  • Archive(File firstVolume) throws RarException, IOException - creates archive to unpack a single file firstVolume
  • Archive(File firstVolume, UnrarCallback unrarCallback) - creates Archive to unpack a single file firstVolume with an event listener UnrarCallback.
File information
  • FileHeader nextFileHeader() - returns next found FileHeader object containing information about packed file
  • List<FileHeader> getFileHeaders() - returns the list with information about all files in the archive
  • MainHeader getMainHeader() - returns the main header of this archive which holds information concerning the whole archive (solid, encrypted etc)
  • boolean isOldFormat() - returns whether the archive is old format (2.9 and lower)
File data
  • void extractFile(FileHeader hd, OutputStream os) throws RarException - unpacks file with the specified by its FileHeader hd to the OutputStream os
  • InputStream getInputStream(final FileHeader hd) throws RarException, IOException - returns an InputStream that will allow to read the file and stream it. Please note that this method will create a new Thread and an a pair of Pipe streams.
Other
  • void close() throws IOException - close the underlying compressed file

Usage