Class Archiver
- java.lang.Object
-
- org.apache.commons.compress.archivers.examples.Archiver
-
public class Archiver extends java.lang.Object
Provides a high level API for creating archives.- Since:
- 1.17
-
-
Constructor Summary
Constructors Constructor Description Archiver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcreate(java.lang.String format, java.io.File target, java.io.File directory)Creates an archivetargetusing the formatformatby recursively including all files and directories indirectory.voidcreate(java.lang.String format, java.io.OutputStream target, java.io.File directory)Creates an archivetargetusing the formatformatby recursively including all files and directories indirectory.voidcreate(java.lang.String format, java.nio.channels.SeekableByteChannel target, java.io.File directory)Creates an archivetargetusing the formatformatby recursively including all files and directories indirectory.voidcreate(ArchiveOutputStream target, java.io.File directory)Creates an archivetargetby recursively including all files and directories indirectory.voidcreate(SevenZOutputFile target, java.io.File directory)Creates an archivetargetby recursively including all files and directories indirectory.
-
-
-
Constructor Detail
-
Archiver
public Archiver()
-
-
Method Detail
-
create
public void create(java.lang.String format, java.io.File target, java.io.File directory) throws java.io.IOException, ArchiveException
Creates an archivetargetusing the formatformatby recursively including all files and directories indirectory.- Parameters:
format- the archive format. This uses the same format as accepted byArchiveStreamFactory.target- the file to write the new archive to.directory- the directory that contains the files to archive.- Throws:
java.io.IOException- if an I/O error occursArchiveException- if the archive cannot be created for other reasons
-
create
public void create(java.lang.String format, java.io.OutputStream target, java.io.File directory) throws java.io.IOException, ArchiveException
Creates an archivetargetusing the formatformatby recursively including all files and directories indirectory.- Parameters:
format- the archive format. This uses the same format as accepted byArchiveStreamFactory.target- the stream to write the new archive to.directory- the directory that contains the files to archive.- Throws:
java.io.IOException- if an I/O error occursArchiveException- if the archive cannot be created for other reasons
-
create
public void create(java.lang.String format, java.nio.channels.SeekableByteChannel target, java.io.File directory) throws java.io.IOException, ArchiveException
Creates an archivetargetusing the formatformatby recursively including all files and directories indirectory.- Parameters:
format- the archive format. This uses the same format as accepted byArchiveStreamFactory.target- the channel to write the new archive to.directory- the directory that contains the files to archive.- Throws:
java.io.IOException- if an I/O error occursArchiveException- if the archive cannot be created for other reasons
-
create
public void create(ArchiveOutputStream target, java.io.File directory) throws java.io.IOException, ArchiveException
Creates an archivetargetby recursively including all files and directories indirectory.- Parameters:
target- the stream to write the new archive to.directory- the directory that contains the files to archive.- Throws:
java.io.IOException- if an I/O error occursArchiveException- if the archive cannot be created for other reasons
-
create
public void create(SevenZOutputFile target, java.io.File directory) throws java.io.IOException
Creates an archivetargetby recursively including all files and directories indirectory.- Parameters:
target- the file to write the new archive to.directory- the directory that contains the files to archive.- Throws:
java.io.IOException- if an I/O error occurs
-
-