Package org.opends.server.backup
Interface BackupStorage
-
- All Superinterfaces:
AutoCloseable
,Closeable
- All Known Implementing Classes:
FileSystemBackupStorage
public interface BackupStorage extends Closeable
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
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default void
close()
void
deleteIfExists(String fileName)
Deletes the file with the provided name.boolean
exists(String fileName)
Tests whether this storage contains a file with the provided name.Stream<String>
list()
Returns a stream containing the existing file names.InputStream
newInputStream(String fileName)
Opens an input stream for reading the file with the provided name.OutputStream
newOutputStream(String fileName)
Opens an output stream for writing data to the file with the provided name.
-
-
-
Method Detail
-
exists
boolean exists(String fileName)
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
void deleteIfExists(String fileName) throws IOException
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
Stream<String> list() throws IOException
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
InputStream newInputStream(String fileName) throws IOException
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
OutputStream newOutputStream(String fileName) throws IOException
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
-
-