Class Archiver
- Since:
- 1.17, 1.21 Supports
Path.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCreates an archivetargetusing the formatformatby recursively including all files and directories indirectory.voidcreate(String format, OutputStream target, File directory) Deprecated.this method leaks resourcesvoidcreate(String format, OutputStream target, File directory, CloseableConsumer closeableConsumer) Creates an archivetargetusing the formatformatby recursively including all files and directories indirectory.voidcreate(String format, SeekableByteChannel target, File directory) Deprecated.this method leaks resourcesvoidcreate(String format, SeekableByteChannel target, File directory, CloseableConsumer closeableConsumer) Creates an archivetargetusing the formatformatby recursively including all files and directories indirectory.voidcreate(String format, SeekableByteChannel target, Path directory) Creates an archivetargetusing the formatformatby recursively including all files and directories indirectory.voidCreates an archivetargetusing the formatformatby recursively including all files and directories indirectory.voidcreate(ArchiveOutputStream<?> target, File directory) Creates an archivetargetby recursively including all files and directories indirectory.voidcreate(ArchiveOutputStream<?> target, Path directory) Creates an archivetargetby recursively including all files and directories indirectory.voidcreate(ArchiveOutputStream<?> target, Path directory, EnumSet<FileVisitOption> fileVisitOptions, LinkOption... linkOptions) Creates an archivetargetby recursively including all files and directories indirectory.voidcreate(SevenZOutputFile target, File directory) Creates an archivetargetby recursively including all files and directories indirectory.voidcreate(SevenZOutputFile target, Path directory) Creates an archivetargetby recursively including all files and directories indirectory.
-
Field Details
-
EMPTY_FileVisitOption
NoFileVisitOption.
-
-
Constructor Details
-
Archiver
public Archiver()
-
-
Method Details
-
create
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:
IOException- if an I/O error occurs
-
create
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:
IOException- if an I/O error occurs or the archive cannot be created for other reasons.- Since:
- 1.21
-
create
public void create(ArchiveOutputStream<?> target, Path directory, EnumSet<FileVisitOption> fileVisitOptions, LinkOption... linkOptions) throws IOException 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.fileVisitOptions- linkOptions to configure the traversal of the sourcedirectory.linkOptions- indicating how symbolic links are handled.- Throws:
IOException- if an I/O error occurs or the archive cannot be created for other reasons.- Since:
- 1.21
-
create
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:
IOException- if an I/O error occurs
-
create
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:
IOException- if an I/O error occurs- Since:
- 1.21
-
create
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:
IOException- if an I/O error occursArchiveException- if the archive cannot be created for other reasons
-
create
@Deprecated public void create(String format, OutputStream target, File directory) throws IOException, ArchiveException Deprecated.this method leaks resourcesCreates an archivetargetusing the formatformatby recursively including all files and directories indirectory.This method creates a wrapper around the target stream which is never closed and thus leaks resources, please use
create(String,OutputStream,File,CloseableConsumer)instead.- 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:
IOException- if an I/O error occursArchiveException- if the archive cannot be created for other reasons
-
create
public void create(String format, OutputStream target, File directory, CloseableConsumer closeableConsumer) throws IOException, ArchiveException Creates an archivetargetusing the formatformatby recursively including all files and directories indirectory.This method creates a wrapper around the archive stream and the caller of this method is responsible for closing it - probably at the same time as closing the stream itself. The caller is informed about the wrapper object via the
closeableConsumercallback as soon as it is no longer needed by this class.- 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.closeableConsumer- is informed about the stream wrapped around the passed in stream- Throws:
IOException- if an I/O error occursArchiveException- if the archive cannot be created for other reasons- Since:
- 1.19
-
create
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:
IOException- if an I/O error occursArchiveException- if the archive cannot be created for other reasons- Since:
- 1.21
-
create
@Deprecated public void create(String format, SeekableByteChannel target, File directory) throws IOException, ArchiveException Deprecated.this method leaks resourcesCreates an archivetargetusing the formatformatby recursively including all files and directories indirectory.This method creates a wrapper around the target channel which is never closed and thus leaks resources, please use
create(String,SeekableByteChannel,File,CloseableConsumer)instead.- 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:
IOException- if an I/O error occursArchiveException- if the archive cannot be created for other reasons
-
create
public void create(String format, SeekableByteChannel target, File directory, CloseableConsumer closeableConsumer) throws IOException, ArchiveException Creates an archivetargetusing the formatformatby recursively including all files and directories indirectory.This method creates a wrapper around the archive channel and the caller of this method is responsible for closing it - probably at the same time as closing the channel itself. The caller is informed about the wrapper object via the
closeableConsumercallback as soon as it is no longer needed by this class.- 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.closeableConsumer- is informed about the stream wrapped around the passed in stream- Throws:
IOException- if an I/O error occursArchiveException- if the archive cannot be created for other reasons- Since:
- 1.19
-
create
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:
IOException- if an I/O error occursIllegalStateException- if the format does not supportSeekableByteChannel.
-