Package ghidra.framework.store.db
Class PackedDBHandle
java.lang.Object
db.DBHandle
ghidra.framework.store.db.PackedDBHandle
DBHandle
provides access to a PackedDatabase.-
Field Summary
-
Constructor Summary
ConstructorDescriptionPackedDBHandle
(String contentType) Constructs a temporary packed database handle. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close the database and dispose of the underlying buffer manager.Returns user defined content type associated with this handle.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.saveAs
(String itemName, File dir, String packedFileName, TaskMonitor monitor) Save open database to a new packed database.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, getModCount, getRecoveryChangeSetFile, getScratchPad, getTable, getTableCount, getTables, hasUncommittedChanges, isChanged, isClosed, isConsistent, isTransactionActive, openTransaction, rebuild, redo, resetDatabaseId, saveAs, setDBVersionedSourceFile, setMaxUndos, setTableName, startTransaction, takeRecoverySnapshot, terminateTransaction, undo
-
Constructor Details
-
PackedDBHandle
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 classDBHandle
- 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
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 classDBHandle
- Parameters:
outFile
- buffer file open for writingnewDatabaseId
- database ID to be forced for new database or null to generate new database IDassociateWithNewFile
- 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 occursCancelledException
- 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 classDBHandle
- Parameters:
outFile
- buffer file open for writingassociateWithNewFile
- 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 occursCancelledException
- 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. -
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 IDmonitor
-- Returns:
- new packed Database object now associated with this handle.
- Throws:
CancelledException
- if task monitor cancelled operation.IOException
DuplicateFileException
-
getContentType
Returns user defined content type associated with this handle. -
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.
-