Package org.opends.server.backup
Class FileSystemBackupStorage
java.lang.Object
org.opends.server.backup.FileSystemBackupStorage
- All Implemented Interfaces:
Closeable,AutoCloseable,BackupStorage
A backup storage implementation that reads and writes files in a file system directory.
-
Constructor Summary
ConstructorsConstructorDescriptionFileSystemBackupStorage(Path backupDirectory) Creates a new data storage for reading and writing files in the provided directory. -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteIfExists(String fileName) Deletes the file with the provided name.booleanTests whether this storage contains a file with the provided name.list()Returns a stream containing the existing file names.newInputStream(String fileName) Opens an input stream for reading the file with the provided name.newOutputStream(String fileName) Opens an output stream for writing data to the file with the provided name.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.opends.server.backup.BackupStorage
close
-
Constructor Details
-
FileSystemBackupStorage
Creates a new data storage for reading and writing files in the provided directory.- Parameters:
backupDirectory- The directory where this storage will read and write data.- Throws:
IOException- If the directory does not exist or is not a directory.
-
-
Method Details
-
exists
Description copied from interface:BackupStorageTests whether this storage contains a file with the provided name.- Specified by:
existsin interfaceBackupStorage- Parameters:
fileName- the name of the file.- Returns:
- whether this storage contains a file with the provided name.
-
deleteIfExists
Description copied from interface:BackupStorageDeletes the file with the provided name.- Specified by:
deleteIfExistsin interfaceBackupStorage- Parameters:
fileName- the name of the file to be deleted.- Throws:
IOException- if an I/O error occurs.
-
list
Description copied from interface:BackupStorageReturns a stream containing the existing file names.- Specified by:
listin interfaceBackupStorage- Returns:
- a stream containing the existing file names.
- Throws:
IOException- if an I/O error occurs.
-
newInputStream
Description copied from interface:BackupStorageOpens an input stream for reading the file with the provided name. The stream will not be buffered and is not required to support theInputStream.mark(int)orInputStream.reset()methods.- Specified by:
newInputStreamin interfaceBackupStorage- Parameters:
fileName- the name of the file to be read.- Returns:
- a new input stream.
- Throws:
IOException- if an I/O error occurs.
-
newOutputStream
Description copied from interface:BackupStorageOpens an output stream for writing data to the file with the provided name. If the file already exists, the data is overwritten, otherwise a new file is created. The resulting stream will not be buffered.- Specified by:
newOutputStreamin interfaceBackupStorage- Parameters:
fileName- the name of the file to write data to.- Returns:
- a new output stream.
- Throws:
IOException- if an I/O error occurs.
-