com.github.junrar
Class Archive

java.lang.Object
  extended by com.github.junrar.Archive
All Implemented Interfaces:
Closeable

public class Archive
extends Object
implements Closeable

The Main Rar Class; represents a rar Archive

Version:
$LastChangedRevision$
Author:
$LastChangedBy$

Constructor Summary
Archive(File firstVolume)
           
Archive(File firstVolume, UnrarCallback unrarCallback)
           
Archive(VolumeManager volumeManager)
           
Archive(VolumeManager volumeManager, UnrarCallback unrarCallback)
          create a new archive object using the given VolumeManager
 
Method Summary
 void bytesReadRead(int count)
           
 void close()
          Close the underlying compressed file.
 void extractFile(FileHeader hd, OutputStream os)
          Extract the file specified by the given header and write it to the supplied output stream
 List<FileHeader> getFileHeaders()
           
 InputStream getInputStream(FileHeader hd)
          Returns an InputStream that will allow to read the file and stream it.
 MainHeader getMainHeader()
           
 IReadOnlyAccess getRof()
           
 UnrarCallback getUnrarCallback()
           
 Volume getVolume()
           
 VolumeManager getVolumeManager()
           
 boolean isEncrypted()
           
 boolean isOldFormat()
           
 FileHeader nextFileHeader()
           
 void setVolume(Volume volume)
           
 void setVolumeManager(VolumeManager volumeManager)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Archive

public Archive(VolumeManager volumeManager)
        throws RarException,
               IOException
Throws:
RarException
IOException

Archive

public Archive(VolumeManager volumeManager,
               UnrarCallback unrarCallback)
        throws RarException,
               IOException
create a new archive object using the given VolumeManager

Parameters:
volumeManager - the the VolumeManager that will provide volume stream data
Throws:
RarException
IOException

Archive

public Archive(File firstVolume)
        throws RarException,
               IOException
Throws:
RarException
IOException

Archive

public Archive(File firstVolume,
               UnrarCallback unrarCallback)
        throws RarException,
               IOException
Throws:
RarException
IOException
Method Detail

bytesReadRead

public void bytesReadRead(int count)

getRof

public IReadOnlyAccess getRof()

getFileHeaders

public List<FileHeader> getFileHeaders()
Returns:
returns all file headers of the archive

nextFileHeader

public FileHeader nextFileHeader()

getUnrarCallback

public UnrarCallback getUnrarCallback()

isEncrypted

public boolean isEncrypted()
Returns:
whether the archive is encrypted

extractFile

public void extractFile(FileHeader hd,
                        OutputStream os)
                 throws RarException
Extract the file specified by the given header and write it to the supplied output stream

Parameters:
header - the header to be extracted
os - the outputstream
Throws:
RarException

getInputStream

public InputStream getInputStream(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.

Parameters:
header - the header to be extracted
Throws:
RarException
IOException - if any IO error occur

getMainHeader

public MainHeader getMainHeader()
Returns:
returns the main header of this archive

isOldFormat

public boolean isOldFormat()
Returns:
whether the archive is old format

close

public void close()
           throws IOException
Close the underlying compressed file.

Specified by:
close in interface Closeable
Throws:
IOException

getVolumeManager

public VolumeManager getVolumeManager()
Returns:
the volumeManager

setVolumeManager

public void setVolumeManager(VolumeManager volumeManager)
Parameters:
volumeManager - the volumeManager to set

getVolume

public Volume getVolume()
Returns:
the volume

setVolume

public void setVolume(Volume volume)
               throws IOException
Parameters:
volume - the volume to set
Throws:
IOException


Copyright © 2012. All Rights Reserved.