Class PackedDBHandle


  • public class PackedDBHandle
    extends DBHandle
    DBHandle provides access to a PackedDatabase.
    • Constructor Detail

      • PackedDBHandle

        public PackedDBHandle​(java.lang.String contentType)
                       throws java.io.IOException
        Constructs a temporary packed database handle.
        Parameters:
        contentType - user defined content type.
        Throws:
        java.io.IOException
    • Method Detail

      • save

        public void save​(java.lang.String comment,
                         DBChangeSet changeSet,
                         TaskMonitor monitor)
                  throws java.io.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:
        java.io.IOException - thrown if an IO error occurs.
        CancelledException - if task monitor cancelled operation.
      • saveAs

        protected void saveAs​(BufferFile outFile,
                              java.lang.Long newDatabaseId,
                              TaskMonitor monitor)
                       throws java.io.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
        monitor - progress monitor
        Throws:
        java.io.IOException - if IO error occurs
        CancelledException - if monitor cancels operation
      • saveAs

        public void saveAs​(BufferFile outFile,
                           boolean associateWithNewFile,
                           TaskMonitor monitor)
                    throws java.io.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:
        java.io.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​(java.lang.String itemName,
                                     java.io.File dir,
                                     java.lang.String packedFileName,
                                     TaskMonitor monitor)
                              throws java.io.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.
        java.io.IOException
        DuplicateFileException
        See Also:
        db.DBHandle#saveAs(java.io.File, java.lang.String, ghidra.util.task.TaskMonitor)
      • saveAs

        public PackedDatabase saveAs​(java.lang.String itemName,
                                     java.io.File dir,
                                     java.lang.String packedFileName,
                                     java.lang.Long newDatabaseId,
                                     TaskMonitor monitor)
                              throws java.io.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.
        java.io.IOException
        DuplicateFileException
        See Also:
        db.DBHandle#saveAs(java.io.File, java.lang.String, ghidra.util.task.TaskMonitor)
      • getContentType

        public java.lang.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.