Class PrivateDatabase

java.lang.Object
db.Database
ghidra.framework.store.db.PrivateDatabase

public class PrivateDatabase extends Database
PrivateDatabase corresponds to a non-versioned database.
  • Constructor Details

  • Method Details

    • createDatabase

      public static LocalManagedBufferFile createDatabase(File dbDir, DBFileListener dbFileListener, int bufferSize) throws IOException
      Create a new database and provide the initial buffer file for writing.
      Parameters:
      dbDir -
      bufferSize -
      Returns:
      initial buffer file
      Throws:
      IOException
    • setIsCheckoutCopy

      public void setIsCheckoutCopy(boolean state)
      If this is a checked-out copy and a cumulative change file should be maintained, this method must be invoked following construction.
    • openBufferFile

      public LocalManagedBufferFile openBufferFile() throws IOException
      Open the current version of this database for non-update use.
      Returns:
      buffer file for non-update use
      Throws:
      IOException
    • openBufferFileForUpdate

      public LocalManagedBufferFile openBufferFileForUpdate() throws IOException
      Open the current version of this database for update use.
      Returns:
      updateable buffer file
      Throws:
      IOException - if updating this database file is not allowed
    • canRecover

      public boolean canRecover()
      Returns true if recovery data exists which may enable recovery of unsaved changes resulting from a previous crash.
    • dbMoved

      public void dbMoved(File dir) throws FileNotFoundException
      Following a move of the database directory, this method should be invoked if this instance will continue to be used.
      Parameters:
      dir - new database directory
      Throws:
      FileNotFoundException - if the database directory cannot be found
    • updateCheckoutCopy

      public void updateCheckoutCopy(ManagedBufferFile srcFile, int oldVersion, TaskMonitor monitor) throws CancelledException, IOException
      If this is a checked-out copy, replace the buffer file content with that provided by the specified srcFile. This Database must be a checkout copy. If a cumulative change files exists, it will be deleted following the update.
      Parameters:
      srcFile - open source data buffer file or null if current version is already up-to-date.
      oldVersion - older version of srcFile from which this database originated.
      Throws:
      IOException
      CancelledException
    • updateCheckoutCopy

      public void updateCheckoutCopy() throws IOException
      If a cumulative change files exists, it will be deleted.
      Throws:
      IOException
    • updateCheckoutFrom

      public void updateCheckoutFrom(PrivateDatabase otherDb) throws IOException
      Move the content of the otherDb into this database. The otherDb will no longer exist if this method is successful. If already open for update, a save should not be done or the database may become corrupted. All existing handles should be closed and reopened when this method is complete.
      Parameters:
      otherDb - the other database.
      Throws:
      IOException - if an IO error occurs. An attempt will be made to restore this database to its original state, however the otherDb will not be repaired and may become unusable.
    • output

      public void output(File outputFile, String name, int filetype, String contentType, TaskMonitor monitor) throws IOException, CancelledException
      Output the current version of this database to a packed storage file.
      Parameters:
      outputFile - packed storage file to be written
      name - database name
      filetype - application file type
      contentType - user content type
      monitor -
      Throws:
      IOException
      CancelledException