Package ghidra.program.model.data
Class FileDataTypeManager
- java.lang.Object
-
- ghidra.program.database.data.DataTypeManagerDB
-
- ghidra.program.model.data.StandAloneDataTypeManager
-
- ghidra.program.model.data.FileDataTypeManager
-
- All Implemented Interfaces:
DataTypeManager
,FileArchiveBasedDataTypeManager
,FileBasedDataTypeManager
public class FileDataTypeManager extends StandAloneDataTypeManager implements FileArchiveBasedDataTypeManager
DataTypeManager for a file. Can import categories from a file, or export categories to a packed database.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
EXTENSION
static java.lang.String
SUFFIX
Suffix for an archive file.-
Fields inherited from class ghidra.program.model.data.StandAloneDataTypeManager
name
-
Fields inherited from class ghidra.program.database.data.DataTypeManagerDB
dataOrganization, dbHandle, defaultListener, sourceArchiveAdapter, universalID
-
Fields inherited from interface ghidra.program.model.data.DataTypeManager
BAD_DATATYPE_ID, BUILT_IN_ARCHIVE_KEY, BUILT_IN_ARCHIVE_UNIVERSAL_ID, BUILT_IN_DATA_TYPES_NAME, DEFAULT_DATATYPE_ID, LOCAL_ARCHIVE_KEY, LOCAL_ARCHIVE_UNIVERSAL_ID, NULL_DATATYPE_ID
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes this dataType managerstatic java.io.File
convertFilename(java.io.File file)
Convert the filename for the given file to have the packed database file extension.static FileDataTypeManager
createFileArchive(java.io.File packedDbfile)
Create a new data-type file archive using the default data organizationvoid
delete()
static void
delete(java.io.File packedDbfile)
void
finalize()
java.lang.String
getFilename()
Get the filename for the current file.java.lang.String
getPath()
ArchiveType
getType()
Returns this manager's archive typeboolean
isClosed()
static FileDataTypeManager
openFileArchive(ResourceFile packedDbfile, boolean openForUpdate)
Open an existing data-type file archive using the default data organizationstatic FileDataTypeManager
openFileArchive(java.io.File packedDbfile, boolean openForUpdate)
Open an existing data-type file archive using the default data organizationvoid
save()
Save the category to source file.void
saveAs(java.io.File saveFile)
Saves the data type manager to the given filevoid
saveAs(java.io.File saveFile, UniversalID newUniversalId)
Saves the data type manager to the given file with a specific databaseId.java.lang.String
toString()
-
Methods inherited from class ghidra.program.model.data.StandAloneDataTypeManager
deleteDataTypeIDs, endTransaction, flushEvents, getDataOrganization, getDomainFileID, getName, replaceDataTypeIDs, setName, startTransaction
-
Methods inherited from class ghidra.program.database.data.DataTypeManagerDB
addDataType, addDataTypeManagerListener, addDataTypes, addDataTypeToDelete, addInvalidatedListener, associateDataTypeWithArchive, categoryCreated, categoryMoved, categoryRemoved, categoryRenamed, clearAllSettings, clearSetting, clearSettings, contains, containsCategory, createCategory, dataTypeAdded, dataTypeChanged, dataTypeDeleted, dataTypeMoved, dataTypeNameChanged, dataTypeReplaced, dbError, deleteAddressRange, disassociate, dispose, doSourceArchiveUpdates, favoritesChanged, findDataType, findDataTypeForID, findDataTypes, findDataTypes, findEnumValueNames, fixupComposites, getAllComposites, getAllDataTypes, getAllDataTypes, getAllStructures, getByteSettingsValue, getCategory, getCategory, getCategoryCount, getDataType, getDataType, getDataType, getDataType, getDataType, getDataTypeCount, getDataTypes, getDataTypes, getDataTypesContaining, getFavorites, getID, getLastChangeTimeForMyManager, getLocalSourceArchive, getLongSettingsValue, getNames, getPointer, getPointer, getResolvedID, getRootCategory, getSettings, getSourceArchive, getSourceArchive, getSourceArchives, getStringSettingsValue, getUniqueName, getUniqueName, getUniversalID, getUnusedConflictName, invalidateCache, isChanged, isCreatingDataType, isEmptySetting, isFavorite, isTransactionActive, isUpdatable, migrateOldFlexArrayComponentsIfRequired, moveAddressRange, remove, removeDataTypeManagerListener, removeInvalidatedListener, removeSourceArchive, replaceDataType, replaceSourceArchive, resolve, resolveSourceArchive, setByteSettingsValue, setFavorite, setLongSettingsValue, setSettings, setStringSettingsValue, sourceArchiveAdded, sourceArchiveChanged, updateID, updateSourceArchiveName, updateSourceArchiveName
-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ghidra.program.model.data.DataTypeManager
addDataType, addDataTypeManagerListener, addDataTypes, addInvalidatedListener, associateDataTypeWithArchive, contains, containsCategory, createCategory, dataTypeChanged, disassociate, endTransaction, findDataType, findDataTypeForID, findDataTypes, findDataTypes, findEnumValueNames, flushEvents, getAllComposites, getAllDataTypes, getAllDataTypes, getAllStructures, getCategory, getCategory, getCategoryCount, getDataOrganization, getDataType, getDataType, getDataType, getDataType, getDataType, getDataTypeCount, getDataTypes, getDataTypesContaining, getFavorites, getID, getLastChangeTimeForMyManager, getLocalSourceArchive, getName, getPointer, getPointer, getResolvedID, getRootCategory, getSourceArchive, getSourceArchives, getUniqueName, getUniversalID, isFavorite, isUpdatable, remove, removeDataTypeManagerListener, removeInvalidatedListener, removeSourceArchive, replaceDataType, resolve, resolveSourceArchive, setFavorite, setName, startTransaction, updateSourceArchiveName, updateSourceArchiveName
-
-
-
-
Field Detail
-
EXTENSION
public static final java.lang.String EXTENSION
- See Also:
- Constant Field Values
-
SUFFIX
public static final java.lang.String SUFFIX
Suffix for an archive file.- See Also:
- Constant Field Values
-
-
Method Detail
-
createFileArchive
public static FileDataTypeManager createFileArchive(java.io.File packedDbfile) throws java.io.IOException
Create a new data-type file archive using the default data organization- Parameters:
packedDbfile
- archive file (filename must end with DataTypeFileManager.SUFFIX)- Returns:
- data-type manager backed by specified packedDbFile
- Throws:
java.io.IOException
-
openFileArchive
public static FileDataTypeManager openFileArchive(java.io.File packedDbfile, boolean openForUpdate) throws java.io.IOException
Open an existing data-type file archive using the default data organization- Parameters:
packedDbfile
- archive file (filename must end with DataTypeFileManager.SUFFIX)openForUpdate
- if true archive will be open for update- Returns:
- data-type manager backed by specified packedDbFile
- Throws:
java.io.IOException
-
openFileArchive
public static FileDataTypeManager openFileArchive(ResourceFile packedDbfile, boolean openForUpdate) throws java.io.IOException
Open an existing data-type file archive using the default data organization- Parameters:
packedDbfile
- archive file (filename must end with DataTypeFileManager.SUFFIX)openForUpdate
- if true archive will be open for update- Returns:
- data-type manager backed by specified packedDbFile
- Throws:
java.io.IOException
-
saveAs
public void saveAs(java.io.File saveFile, UniversalID newUniversalId) throws DuplicateFileException, java.io.IOException
Saves the data type manager to the given file with a specific databaseId. NOTE: This method is intended for use in transforming one archive database to match another existing archive database.- Parameters:
saveFile
- the file to savenewUniversalId
- the new id to use- Throws:
DuplicateFileException
java.io.IOException
-
saveAs
public void saveAs(java.io.File saveFile) throws DuplicateFileException, java.io.IOException
Saves the data type manager to the given file- Parameters:
saveFile
- the file to save- Throws:
DuplicateFileException
java.io.IOException
-
save
public void save() throws java.io.IOException
Save the category to source file.- Throws:
java.io.IOException
-
getFilename
public java.lang.String getFilename()
Get the filename for the current file.- Returns:
- String filename, or null if there is no current file.
-
convertFilename
public static java.io.File convertFilename(java.io.File file)
Convert the filename for the given file to have the packed database file extension.- Parameters:
file
- file whose name is to be converted- Returns:
- file if the filename already ends in the packed database file extension, or a new File object that has the packed database file extension
-
delete
public void delete() throws java.io.IOException
- Throws:
java.io.IOException
-
close
public void close()
Description copied from interface:DataTypeManager
Closes this dataType manager- Specified by:
close
in interfaceDataTypeManager
- Overrides:
close
in classStandAloneDataTypeManager
-
isClosed
public boolean isClosed()
-
finalize
public void finalize()
- Overrides:
finalize
in classStandAloneDataTypeManager
-
delete
public static void delete(java.io.File packedDbfile) throws java.io.IOException
- Throws:
java.io.IOException
-
getPath
public java.lang.String getPath()
- Specified by:
getPath
in interfaceFileBasedDataTypeManager
- Overrides:
getPath
in classStandAloneDataTypeManager
-
getType
public ArchiveType getType()
Description copied from interface:DataTypeManager
Returns this manager's archive type- Specified by:
getType
in interfaceDataTypeManager
- Overrides:
getType
in classStandAloneDataTypeManager
- Returns:
- the type
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-