org.apache.commons.compress
Interface Archive

All Known Implementing Classes:
AbstractArchive, TarArchive, ZipArchive

public interface Archive

Archive is the interface which defines all operations for all possible archive-operations. TODO: - delete files from an archive - add files to an existing archive - recursivley add directories


Method Summary
 void add(ArchiveEntry entry)
          Adds a FileInputStream to the internal filelist for a possible pack-operation
 void add(File file)
          Adds a file to the internal filelist for a possible pack-operation
 void close()
          Closes this archiver and all internal streams.
 File getArchive()
          Returns the archive file and null, if this archiver has not been saved yet or there has not been set an archive manually.
 Iterator getEntryIterator()
          Get an iterator of ArchiveEntrys which shall be archived
 void save(File output)
          Packs this file.
 void save(OutputStream output)
          Packs a file.
 void setArchive(File file)
          Sets an Archive for manipulating.
 void unpack(File destinationDir)
          Unpacks to the specified directory
 

Method Detail

add

void add(File file)
         throws FileNotFoundException
Adds a file to the internal filelist for a possible pack-operation

Throws:
FileNotFoundException

add

void add(ArchiveEntry entry)
Adds a FileInputStream to the internal filelist for a possible pack-operation


save

void save(OutputStream output)
          throws ArchiveException
Packs a file. The destination filename must be set manually with setDestinationFile(...). There must be at least 1 file to be packed.

Throws:
ArchiveException - if there is no destination file or files to be packed

save

void save(File output)
          throws ArchiveException
Packs this file. This methods ignores what has been set in setDestinationFile(...) and uses the filename of the parameter. This string must not be null.

Throws:
ArchiveException - if there is no destination file or files to be packed

setArchive

void setArchive(File file)
Sets an Archive for manipulating. An archive is set if someone saves an Archive or calls getInstance(...) with an archive.

Parameters:
file - the file to manipulate

getArchive

File getArchive()
Returns the archive file and null, if this archiver has not been saved yet or there has not been set an archive manually.

Returns:
the archiver, or null

unpack

void unpack(File destinationDir)
            throws UnpackException
Unpacks to the specified directory

Parameters:
destinationDir - to unpack
Throws:
UnpackException - if an unpack error occurs

getEntryIterator

Iterator getEntryIterator()
Get an iterator of ArchiveEntrys which shall be archived

Returns:
the iterator

close

void close()
           throws IOException
Closes this archiver and all internal streams.

Throws:
IOException


Copyright © 2011 Apache Software Foundation. All Rights Reserved.