Package ghidra.framework.store.db

# Class PackedDBHandle

java.lang.Object
db.DBHandle
ghidra.framework.store.db.PackedDBHandle

public class PackedDBHandle extends DBHandle
`DBHandle` provides access to a PackedDatabase.

- ## Field Summary

  ### Fields inherited from class db.DBHandle

  `bufferMgr`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `PackedDBHandle(String contentType)`
  Constructs a temporary packed database handle.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  Close the database and dispose of the underlying buffer manager.
  `String`
  `getContentType()`
  Returns user defined content type associated with this handle.
  `PackedDatabase`
  `getPackedDatabase()`
  Returns PackedDatabase associated with this handle, or null if this is a temporary handle which has not yet been saved to a PackedDatabase using saveAs.
  `void`
  `save(TaskMonitor monitor)`
  Saves the open database to the corresponding PackedDatabase file.
  `void`
  `save(String comment, DBChangeSet changeSet, TaskMonitor monitor)`
  Save this database to a new version.
  `void`
  `saveAs(BufferFile outFile, boolean associateWithNewFile, TaskMonitor monitor)`
  Save the database to the specified buffer file.
  `protected void`
  `saveAs(BufferFile outFile, Long newDatabaseId, boolean associateWithNewFile, TaskMonitor monitor)`
  Save the database to the specified buffer file and a newDatabaseId.
  `PackedDatabase`
  `saveAs(String itemName, File dir, String packedFileName, TaskMonitor monitor)`
  Save open database to a new packed database.
  `PackedDatabase`
  `saveAs(String itemName, File dir, String packedFileName, Long newDatabaseId, TaskMonitor monitor)`
  Save open database to a new packed database with a specified newDatabaseId.

  ### Methods inherited from class db.DBHandle

  `addListener, canRedo, canUndo, canUpdate, checkIsClosed, checkTransaction, close, closeScratchPad, createBuffer, createBuffer, createTable, createTable, deleteTable, enablePreCache, endTransaction, finalize, getAvailableRedoCount, getAvailableUndoCount, getBuffer, getBuffer, getBufferSize, getCacheHits, getCacheMisses, getDatabaseId, getLowBufferCount, getRecoveryChangeSetFile, getScratchPad, getTable, getTableCount, getTables, hasUncommittedChanges, isChanged, isClosed, isConsistent, isTransactionActive, openTransaction, rebuild, redo, resetDatabaseId, saveAs, setMaxUndos, setTableName, startTransaction, takeRecoverySnapshot, terminateTransaction, undo`

  ### Methods inherited from class java.lang.Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### PackedDBHandle

    public PackedDBHandle(String contentType) throws IOException
    Constructs a temporary packed database handle.
    Parameters:
      `contentType` - user defined content type.
    Throws:
      `IOException`

- ## Method Details

  - ### save

    public void save(String comment, DBChangeSet changeSet, TaskMonitor monitor) throws IOException, CancelledException
    Description copied from class: `DBHandle`
    Save this database to a new version.
    Overrides:
      `save` in class `DBHandle`
    Parameters:
      `comment` - if version history is maintained, this comment will be associated with the new version.
      `changeSet` - an optional database-backed change set which reflects changes made since the last version.
      `monitor` - progress monitor
    Throws:
      `IOException` - thrown if an IO error occurs.
      `CancelledException` - if task monitor cancelled operation.

  - ### save

    public void save(TaskMonitor monitor) throws IOException, CancelledException
    Saves the open database to the corresponding PackedDatabase file.
    Parameters:
      `monitor` -
    Throws:
      `IOException`
      `CancelledException`

  - ### saveAs

    protected void saveAs(BufferFile outFile, Long newDatabaseId, boolean associateWithNewFile, TaskMonitor monitor) throws IOException, CancelledException
    Description copied from class: `DBHandle`
    Save the database to the specified buffer file and a newDatabaseId. Open handle will always be associated with the new file. NOTE: This method is intended for use in transforming one database to match another existing database.
    Overrides:
      `saveAs` in class `DBHandle`
    Parameters:
      `outFile` - buffer file open for writing
      `newDatabaseId` - database ID to be forced for new database or null to generate new database ID
      `associateWithNewFile` - if true the outFile will be associated with this DBHandle as the current source file, if false no change will be made to this DBHandle's state and the outFile will be written and set as read-only. The caller is responsbile for disposing the outFile if this parameter is false.
      `monitor` - progress monitor
    Throws:
      `IOException` - if IO error occurs
      `CancelledException` - if monitor cancels operation

  - ### saveAs

    public void saveAs(BufferFile outFile, boolean associateWithNewFile, TaskMonitor monitor) throws IOException, CancelledException
    Description copied from class: `DBHandle`
    Save the database to the specified buffer file.
    Overrides:
      `saveAs` in class `DBHandle`
    Parameters:
      `outFile` - buffer file open for writing
      `associateWithNewFile` - if true the outFile will be associated with this DBHandle as the current source file, if false no change will be made to this DBHandle's state and the outFile will be written and set as read-only. The caller is responsbile for disposing the outFile if this parameter is false.
      `monitor` - progress monitor
    Throws:
      `IOException` - if IO error occurs
      `CancelledException` - if monitor cancels operation

  - ### close

    public void close()
    Description copied from class: `DBHandle`
    Close the database and dispose of the underlying buffer manager. Any existing recovery data will be discarded.
    Overrides:
      `close` in class `DBHandle`

  - ### saveAs

    public PackedDatabase saveAs(String itemName, File dir, String packedFileName, TaskMonitor monitor) throws IOException, DuplicateFileException, CancelledException
    Save open database to a new packed database. If another PackedDatabase was associated with this handle prior to this invocation it should be disposed to that the underlying database resources can be cleaned-up.
    Parameters:
      `itemName` -
      `dir` -
      `packedFileName` -
      `monitor` -
    Returns:
      new packed Database object now associated with this handle.
    Throws:
      `CancelledException` - if task monitor cancelled operation.
      `IOException`
      `DuplicateFileException`

  - ### saveAs

    public PackedDatabase saveAs(String itemName, File dir, String packedFileName, Long newDatabaseId, TaskMonitor monitor) throws IOException, DuplicateFileException, CancelledException
    Save open database to a new packed database with a specified newDatabaseId. If another PackedDatabase was associated with this handle prior to this invocation it should be disposed to that the underlying database resources can be cleaned-up. NOTE: This method is intended for use in transforming one database to match another existing database.
    Parameters:
      `itemName` -
      `dir` -
      `packedFileName` -
      `newDatabaseId` - database ID to be forced for new database or null to generate new database ID
      `monitor` -
    Returns:
      new packed Database object now associated with this handle.
    Throws:
      `CancelledException` - if task monitor cancelled operation.
      `IOException`
      `DuplicateFileException`

  - ### getContentType

    public String getContentType()
    Returns user defined content type associated with this handle.

  - ### getPackedDatabase

    public PackedDatabase getPackedDatabase()
    Returns PackedDatabase associated with this handle, or null if this is a temporary handle which has not yet been saved to a PackedDatabase using saveAs.