Class FileSystemBackupStorage

java.lang.Object
org.opends.server.backup.FileSystemBackupStorage
All Implemented Interfaces:
Closeable, AutoCloseable, BackupStorage

public final class FileSystemBackupStorage extends Object implements BackupStorage
A backup storage implementation that reads and writes files in a file system directory.
  • Constructor Details

    • FileSystemBackupStorage

      public FileSystemBackupStorage(Path backupDirectory) throws IOException
      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

      public boolean exists(String fileName)
      Description copied from interface: BackupStorage
      Tests whether this storage contains a file with the provided name.
      Specified by:
      exists in interface BackupStorage
      Parameters:
      fileName - the name of the file.
      Returns:
      whether this storage contains a file with the provided name.
    • deleteIfExists

      public void deleteIfExists(String fileName) throws IOException
      Description copied from interface: BackupStorage
      Deletes the file with the provided name.
      Specified by:
      deleteIfExists in interface BackupStorage
      Parameters:
      fileName - the name of the file to be deleted.
      Throws:
      IOException - if an I/O error occurs.
    • list

      public Stream<String> list() throws IOException
      Description copied from interface: BackupStorage
      Returns a stream containing the existing file names.
      Specified by:
      list in interface BackupStorage
      Returns:
      a stream containing the existing file names.
      Throws:
      IOException - if an I/O error occurs.
    • newInputStream

      public InputStream newInputStream(String fileName) throws IOException
      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 the InputStream.mark(int) or InputStream.reset() methods.
      Specified by:
      newInputStream in interface BackupStorage
      Parameters:
      fileName - the name of the file to be read.
      Returns:
      a new input stream.
      Throws:
      IOException - if an I/O error occurs.
    • newOutputStream

      public OutputStream newOutputStream(String fileName) throws IOException
      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 interface BackupStorage
      Parameters:
      fileName - the name of the file to write data to.
      Returns:
      a new output stream.
      Throws:
      IOException - if an I/O error occurs.