public class CloseableBackupBuilder extends Object implements Closeable, BackupBuilder
addToBackup(Collection, File)
methods adds additional files to the archive.
Requires closing to finalize creation of valid archive.
Once closed will no longer allow adding any new files, and all methods will throw IOException
Modifier and Type | Method and Description |
---|---|
void |
addToBackup(Collection<File> files,
File rootDirectory)
Add files to backup being built.
|
void |
close()
Closes this stream and releases any system resources associated with it.
|
static CloseableBackupBuilder |
open(File snapshot,
ArchiveUtils.Type archiveType,
java.util.function.Consumer<File> filesObserver)
Creates a new builder.
|
public static CloseableBackupBuilder open(@Nonnull File snapshot, @Nonnull ArchiveUtils.Type archiveType, @Nullable java.util.function.Consumer<File> filesObserver)
snapshot
of type archiveType
.archiveType
- path of archive to create, the file should not existsnapshot
- path of archive to createfilesObserver
- optional consumer that will have access to all processed files before they're added to archivepublic void addToBackup(Collection<File> files, File rootDirectory)
rootDirectory
addToBackup
in interface BackupBuilder
files
- list of existing files to be included to the backuprootDirectory
- determines relative subpaths of files in the archive , must be parent to the files
(will throw an exeption otherwise)public void close()
Closeable
close
in interface Closeable
close
in interface AutoCloseable
Copyright © 2002-2024 Atlassian. All Rights Reserved.