Package org.opends.server.backup
Interface BackupStorage
- All Superinterfaces:
AutoCloseable
,Closeable
- All Known Implementing Classes:
FileSystemBackupStorage
A backup storage is responsible for writing and reading backup files in a persistent location. This interface does
not support nested structures like sub-directories. Backup files are identified with file names, implementations
should take into consideration that these names may contain any characters allowed by file systems for file names.
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
close()
void
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.
-
Method Details
-
exists
Tests whether this storage contains a file with the provided name.- Parameters:
fileName
- the name of the file.- Returns:
- whether this storage contains a file with the provided name.
-
deleteIfExists
Deletes the file with the provided name.- Parameters:
fileName
- the name of the file to be deleted.- Throws:
IOException
- if an I/O error occurs.
-
list
Returns a stream containing the existing file names.- Returns:
- a stream containing the existing file names.
- Throws:
IOException
- if an I/O error occurs.
-
newInputStream
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.- Parameters:
fileName
- the name of the file to be read.- Returns:
- a new input stream.
- Throws:
IOException
- if an I/O error occurs.
-
newOutputStream
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.- Parameters:
fileName
- the name of the file to write data to.- Returns:
- a new output stream.
- Throws:
IOException
- if an I/O error occurs.
-
close
default void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-