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
ConstructorDescriptionFileSystemBackupStorage
(Path backupDirectory) Creates a new data storage for reading and writing files in the provided directory. -
Method Summary
Modifier and TypeMethodDescriptionvoid
deleteIfExists
(String fileName) Deletes the file with the provided name.boolean
Tests 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, wait
Methods 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:BackupStorage
Tests whether this storage contains a file with the provided name.- Specified by:
exists
in interfaceBackupStorage
- Parameters:
fileName
- the name of the file.- Returns:
- whether this storage contains a file with the provided name.
-
deleteIfExists
Description copied from interface:BackupStorage
Deletes the file with the provided name.- Specified by:
deleteIfExists
in interfaceBackupStorage
- Parameters:
fileName
- the name of the file to be deleted.- Throws:
IOException
- if an I/O error occurs.
-
list
Description copied from interface:BackupStorage
Returns a stream containing the existing file names.- Specified by:
list
in interfaceBackupStorage
- Returns:
- a stream containing the existing file names.
- Throws:
IOException
- if an I/O error occurs.
-
newInputStream
Description copied from interface:BackupStorage
Opens 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:
newInputStream
in 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:BackupStorage
Opens 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:
newOutputStream
in 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.
-