Class FileSystemBackupStorage

    • Constructor Detail

      • 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 Detail

      • 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.
      • 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.