Modifier and Type | Field and Description |
---|---|
static EnumSet<FileVisitOption> |
EMPTY_FileVisitOption
No
FileVisitOption . |
Constructor and Description |
---|
Archiver() |
Modifier and Type | Method and Description |
---|---|
void |
create(ArchiveOutputStream target,
File directory)
Creates an archive
target by recursively including all files and directories in directory . |
void |
create(ArchiveOutputStream target,
Path directory)
Creates an archive
target by recursively including all files and directories in directory . |
void |
create(ArchiveOutputStream target,
Path directory,
EnumSet<FileVisitOption> fileVisitOptions,
LinkOption... linkOptions)
Creates an archive
target by recursively including all files and directories in directory . |
void |
create(SevenZOutputFile target,
File directory)
Creates an archive
target by recursively including all files and directories in directory . |
void |
create(SevenZOutputFile target,
Path directory)
Creates an archive
target by recursively including all files and directories in directory . |
void |
create(String format,
File target,
File directory)
Creates an archive
target using the format format by recursively including all files and directories in directory . |
void |
create(String format,
OutputStream target,
File directory)
Deprecated.
this method leaks resources
|
void |
create(String format,
OutputStream target,
File directory,
CloseableConsumer closeableConsumer)
Creates an archive
target using the format format by recursively including all files and directories in directory . |
void |
create(String format,
Path target,
Path directory)
Creates an archive
target using the format format by recursively including all files and directories in directory . |
void |
create(String format,
SeekableByteChannel target,
File directory)
Deprecated.
this method leaks resources
|
void |
create(String format,
SeekableByteChannel target,
File directory,
CloseableConsumer closeableConsumer)
Creates an archive
target using the format format by recursively including all files and directories in directory . |
void |
create(String format,
SeekableByteChannel target,
Path directory)
Creates an archive
target using the format format by recursively including all files and directories in directory . |
public static final EnumSet<FileVisitOption> EMPTY_FileVisitOption
FileVisitOption
.public Archiver()
public void create(ArchiveOutputStream target, File directory) throws IOException, ArchiveException
target
by recursively including all files and directories in directory
.target
- the stream to write the new archive to.directory
- the directory that contains the files to archive.IOException
- if an I/O error occursArchiveException
- if the archive cannot be created for other reasonspublic void create(ArchiveOutputStream target, Path directory, EnumSet<FileVisitOption> fileVisitOptions, LinkOption... linkOptions) throws IOException
target
by recursively including all files and directories in directory
.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 source directory
.linkOptions
- indicating how symbolic links are handled.IOException
- if an I/O error occurs or the archive cannot be created for other reasons.public void create(ArchiveOutputStream target, Path directory) throws IOException
target
by recursively including all files and directories in directory
.target
- the stream to write the new archive to.directory
- the directory that contains the files to archive.IOException
- if an I/O error occurs or the archive cannot be created for other reasons.public void create(SevenZOutputFile target, File directory) throws IOException
target
by recursively including all files and directories in directory
.target
- the file to write the new archive to.directory
- the directory that contains the files to archive.IOException
- if an I/O error occurspublic void create(SevenZOutputFile target, Path directory) throws IOException
target
by recursively including all files and directories in directory
.target
- the file to write the new archive to.directory
- the directory that contains the files to archive.IOException
- if an I/O error occurspublic void create(String format, File target, File directory) throws IOException, ArchiveException
target
using the format format
by recursively including all files and directories in directory
.format
- the archive format. This uses the same format as accepted by ArchiveStreamFactory
.target
- the file to write the new archive to.directory
- the directory that contains the files to archive.IOException
- if an I/O error occursArchiveException
- if the archive cannot be created for other reasons@Deprecated public void create(String format, OutputStream target, File directory) throws IOException, ArchiveException
target
using the format format
by recursively including all files and directories in directory
.
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.
format
- the archive format. This uses the same format as accepted by ArchiveStreamFactory
.target
- the stream to write the new archive to.directory
- the directory that contains the files to archive.IOException
- if an I/O error occursArchiveException
- if the archive cannot be created for other reasonspublic void create(String format, OutputStream target, File directory, CloseableConsumer closeableConsumer) throws IOException, ArchiveException
target
using the format format
by recursively including all files and directories in directory
.
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 closeableConsumer
callback as soon as it is no longer needed by this class.
format
- the archive format. This uses the same format as accepted by ArchiveStreamFactory
.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 streamIOException
- if an I/O error occursArchiveException
- if the archive cannot be created for other reasonspublic void create(String format, Path target, Path directory) throws IOException, ArchiveException
target
using the format format
by recursively including all files and directories in directory
.format
- the archive format. This uses the same format as accepted by ArchiveStreamFactory
.target
- the file to write the new archive to.directory
- the directory that contains the files to archive.IOException
- if an I/O error occursArchiveException
- if the archive cannot be created for other reasons@Deprecated public void create(String format, SeekableByteChannel target, File directory) throws IOException, ArchiveException
target
using the format format
by recursively including all files and directories in directory
.
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.
format
- the archive format. This uses the same format as accepted by ArchiveStreamFactory
.target
- the channel to write the new archive to.directory
- the directory that contains the files to archive.IOException
- if an I/O error occursArchiveException
- if the archive cannot be created for other reasonspublic void create(String format, SeekableByteChannel target, File directory, CloseableConsumer closeableConsumer) throws IOException, ArchiveException
target
using the format format
by recursively including all files and directories in directory
.
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 closeableConsumer
callback as soon as it is no longer needed by this class.
format
- the archive format. This uses the same format as accepted by ArchiveStreamFactory
.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 streamIOException
- if an I/O error occursArchiveException
- if the archive cannot be created for other reasonspublic void create(String format, SeekableByteChannel target, Path directory) throws IOException
target
using the format format
by recursively including all files and directories in directory
.format
- the archive format. This uses the same format as accepted by ArchiveStreamFactory
.target
- the channel to write the new archive to.directory
- the directory that contains the files to archive.IOException
- if an I/O error occursIllegalStateException
- if the format does not support SeekableByteChannel
.Copyright © 2002–2020 The Apache Software Foundation. All rights reserved.