Interface IFileDatabase

All Known Implementing Classes:
JDB2Manager, ProjectFileStore

public interface IFileDatabase
Database of binary blobs keyed by unique identifiers.

Typical implementations include in-memory or delegated stores and on-disk JDB2 databases.

  • Method Details

    • hasFile

      boolean hasFile(String key)
      Determine if the database contains the given file (the file must exist).
      Parameters:
      key - file key
      Returns:
      presence indicator
    • saveFile

      boolean saveFile(String key, byte[] data)
      Store the contents of a file.
      Parameters:
      key - file key
      data - file data
      Returns:
      success indicator
    • loadFile

      byte[] loadFile(String key)
      Retrieve the contents of a file.
      Parameters:
      key - file key
      Returns:
      file data, null on error
    • deleteFile

      boolean deleteFile(String key)
      Delete a file.
      Parameters:
      key - file key
      Returns:
      success indicator
    • getFileObject

      File getFileObject(String key)
      Attempt to get the filesystem object backing this db file entry.

      This method may not be implemented (e.g. if this database is not backed by on-disk files), in which case the implementation may throw an UnsupportedOperationException.

      Parameters:
      key - file key
      Returns:
      the backing file object for the entry
    • getFileWriter

      OutputStream getFileWriter(String key) throws IOException
      Get an output stream reader for low-level writing to a file. The client is responsible for closing the stream after usage.

      This method may not be implemented, in which case the implementation may throw an UnsupportedOperationException.

      Parameters:
      key - file key
      Returns:
      an output stream writing to the entry contents
      Throws:
      IOException - if the writer could not be created
    • getFileReader

      InputStream getFileReader(String key) throws IOException
      Get an input stream reader for low-level reading from a file. The client is responsible for closing the stream after usage.

      This method may not be implemented, in which case the implementation may throw an UnsupportedOperationException.

      Parameters:
      key - file key
      Returns:
      an input stream reading the entry contents
      Throws:
      IOException - if the reader could not be created
    • getDatabaseWriter

      IFileDatabaseWriter getDatabaseWriter(String key) throws IOException
      Get a database record writer.

      This method may not be implemented, in which case the implementation may throw an UnsupportedOperationException.

      Parameters:
      key - file key
      Returns:
      a structured database writer for the entry
      Throws:
      IOException - if the writer could not be created
    • getDatabaseReader

      IFileDatabaseReader getDatabaseReader(String key) throws IOException
      Get a database record reader.

      This method may not be implemented, in which case the implementation may throw an UnsupportedOperationException.

      Parameters:
      key - file key
      Returns:
      a structured database reader for the entry
      Throws:
      IOException - if the reader could not be created