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`, `Closeable`, `AutoCloseable`

public class FileDataTypeManager extends StandAloneDataTypeManager implements FileArchiveBasedDataTypeManager
DataTypeManager for a file. Can import categories from a file, or export categories to a packed database.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class ghidra.program.model.data.StandAloneDataTypeManager

  `StandAloneDataTypeManager.ArchiveWarning, StandAloneDataTypeManager.ArchiveWarningLevel, StandAloneDataTypeManager.LanguageUpdateOption`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `EXTENSION`
  `static final GhidraFileFilter`
  `GDT_FILEFILTER`
  `static final 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

  `addrMap, dbHandle, DEFAULT_CALLING_CONVENTION_ID, defaultListener, errHandler, lock, readOnlyMode, sourceArchiveAdapter, tablePrefix, universalID, UNKNOWN_CALLING_CONVENTION_ID`

  ### 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

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  Closes this dataType manager
  `static File`
  `convertFilename(File file)`
  Convert the filename for the given file to have the packed database file extension.
  `static FileDataTypeManager`
  `createFileArchive(File packedDbfile)`
  Create a new data-type file archive using the default data organization
  `void`
  `delete()`
  `static void`
  `delete(File packedDbfile)`
  `void`
  `finalize()`
  `String`
  `getFilename()`
  Get the filename for the current file.
  `String`
  `getPath()`
  Get the path name associated with the storage of this stand alone datatype manager.
  `ArchiveType`
  `getType()`
  Returns this manager's archive type
  `boolean`
  `isClosed()`
  `static FileDataTypeManager`
  `openFileArchive(ResourceFile packedDbfile, boolean openForUpdate)`
  Open an existing data-type file archive using the default data organization.
  `static FileDataTypeManager`
  `openFileArchive(File packedDbfile, boolean openForUpdate)`
  Open an existing data-type file archive using the default data organization.
  `void`
  `save()`
  Save the category to source file.
  `void`
  `saveAs(File saveFile)`
  Saves the data type manager to the given file
  `void`
  `saveAs(File saveFile, UniversalID newUniversalId)`
  Saves the data type manager to the given file with a specific databaseId.
  `String`
  `toString()`

  ### Methods inherited from class ghidra.program.model.data.StandAloneDataTypeManager

  `clearProgramArchitecture, deleteDataTypeIDs, endTransaction, flushEvents, getDomainFileID, getName, getProgramArchitectureSummary, getWarning, getWarningDetail, getWarningMessage, handleDataOrganizationChange, initializeOtherAdapters, isArchitectureChangeAllowed, isProgramArchitectureMissing, isProgramArchitectureUpgradeRequired, logWarning, openTransaction, replaceDataTypeIDs, setName, setProgramArchitecture, setProgramArchitecture, startTransaction`

  ### Methods inherited from class ghidra.program.database.data.DataTypeManagerDB

  `addDataType, addDataTypeManagerListener, addDataTypes, addDataTypeToDelete, addInvalidatedListener, allowsDefaultBuiltInSettings, allowsDefaultComponentSettings, associateDataTypeWithArchive, categoryCreated, categoryMoved, categoryRemoved, categoryRenamed, compilerSpecChanged, contains, containsCategory, createCategory, dataTypeAdded, dataTypeChanged, dataTypeDeleted, dataTypeMoved, dataTypeNameChanged, dataTypeReplaced, dataTypeSettingsChanged, dbError, disassociate, dispose, doSourceArchiveUpdates, favoritesChanged, findDataType, findDataTypeForID, findDataTypes, findDataTypes, findEnumValueNames, fixupComposites, getAddressMap, getAllComposites, getAllDataTypes, getAllDataTypes, getAllFunctionDefinitions, getAllStructures, getCallingConvention, getCallingConventionID, getCallingConventionName, getCategory, getCategory, getCategoryCount, getDataMap, getDataOrganization, getDataType, getDataType, getDataType, getDataType, getDataType, getDataTypeCount, getDataTypes, getDataTypes, getDataTypesContaining, getDefaultCallingConvention, getDefinedCallingConventionNames, getFavorites, getID, getKnownCallingConventionNames, getLastChangeTimeForMyManager, getLocalSourceArchive, getPointer, getPointer, getProgramArchitecture, getProgramArchitectureSummary, getResolvedID, getRootCategory, getSourceArchive, getSourceArchive, getSourceArchives, getUniqueName, getUniversalID, getUnusedConflictName, getUnusedConflictName, getVariableStorageManager, hasDataOrganizationChange, invalidateCache, isChanged, isCreatingDataType, isFavorite, isTransactionActive, isUpdatable, migrateOldFlexArrayComponentsIfRequired, readDataOrganization, remove, removeDataTypeManagerListener, removeInvalidatedListener, removeSourceArchive, replaceDataType, replaceSourceArchive, resolve, resolveSourceArchive, saveDataOrganization, setFavorite, sourceArchiveAdded, sourceArchiveChanged, updateID, updateLastChangeTime, 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, allowsDefaultBuiltInSettings, allowsDefaultComponentSettings, associateDataTypeWithArchive, contains, containsCategory, createCategory, disassociate, endTransaction, findDataType, findDataTypeForID, findDataTypes, findDataTypes, findEnumValueNames, flushEvents, getAddressMap, getAllComposites, getAllDataTypes, getAllDataTypes, getAllFunctionDefinitions, getAllStructures, getCallingConvention, getCategory, getCategory, getCategoryCount, getDataOrganization, getDataType, getDataType, getDataType, getDataType, getDataType, getDataTypeCount, getDataTypes, getDataTypesContaining, getDefaultCallingConvention, getDefinedCallingConventionNames, getFavorites, getID, getKnownCallingConventionNames, getLastChangeTimeForMyManager, getLocalSourceArchive, getName, getPointer, getPointer, getProgramArchitecture, getProgramArchitectureSummary, getResolvedID, getRootCategory, getSourceArchive, getSourceArchives, getUniqueName, getUniversalID, isFavorite, isUpdatable, openTransaction, remove, removeDataTypeManagerListener, removeInvalidatedListener, removeSourceArchive, replaceDataType, resolve, resolveSourceArchive, setFavorite, setName, startTransaction, updateSourceArchiveName, updateSourceArchiveName`

- ## Field Details

  - ### EXTENSION

    public static final String EXTENSION
    See Also:
      - Constant Field Values

  - ### GDT_FILEFILTER

    public static final GhidraFileFilter GDT_FILEFILTER

  - ### SUFFIX

    public static final String SUFFIX
    Suffix for an archive file.
    See Also:
      - Constant Field Values

- ## Method Details

  - ### createFileArchive

    public static FileDataTypeManager createFileArchive(File packedDbfile) throws 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:
      `IOException` - if an IO error occurs

  - ### openFileArchive

    public static FileDataTypeManager openFileArchive(File packedDbfile, boolean openForUpdate) throws IOException
    Open an existing data-type file archive using the default data organization.

    NOTE: If archive has an assigned architecture, issues may arise due to a revised or missing `Language`/`CompilerSpec` which will result in a warning but not prevent the archive from being opened. Such a warning condition will ne logged and may result in missing or stale information for existing datatypes which have architecture related data. In some case it may be appropriate to `check for warnings` on the returned archive object prior to its use.

    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:
      `IOException` - if an IO error occurs

  - ### openFileArchive

    public static FileDataTypeManager openFileArchive(ResourceFile packedDbfile, boolean openForUpdate) throws IOException
    Open an existing data-type file archive using the default data organization.

    NOTE: If archive has an assigned architecture, issues may arise due to a revised or missing `Language`/`CompilerSpec` which will result in a warning but not prevent the archive from being opened. Such a warning condition will ne logged and may result in missing or stale information for existing datatypes which have architecture related data. In some case it may be appropriate to `check for warnings` on the returned archive object prior to its use.

    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:
      `IOException` - if an IO error occurs

  - ### saveAs

    public void saveAs(File saveFile, UniversalID newUniversalId) throws DuplicateFileException, 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 save
      `newUniversalId` - the new id to use
    Throws:
      `DuplicateFileException`
      `IOException`

  - ### saveAs

    public void saveAs(File saveFile) throws DuplicateFileException, IOException
    Saves the data type manager to the given file
    Parameters:
      `saveFile` - the file to save
    Throws:
      `DuplicateFileException`
      `IOException`

  - ### save

    public void save() throws IOException
    Save the category to source file.
    Throws:
      `IOException`

  - ### getFilename

    public String getFilename()
    Get the filename for the current file.
    Returns:
      String filename, or null if there is no current file.

  - ### convertFilename

    public static File convertFilename(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 IOException
    Throws:
      `IOException`

  - ### close

    public void close()
    Description copied from interface: `DataTypeManager`
    Closes this dataType manager
    Specified by:
      `close` in interface `AutoCloseable`
    Specified by:
      `close` in interface `Closeable`
    Specified by:
      `close` in interface `DataTypeManager`
    Overrides:
      `close` in class `StandAloneDataTypeManager`

  - ### isClosed

    public boolean isClosed()

  - ### finalize

    public void finalize()
    Overrides:
      `finalize` in class `StandAloneDataTypeManager`

  - ### delete

    public static void delete(File packedDbfile) throws IOException
    Throws:
      `IOException`

  - ### getPath

    public String getPath()
    Description copied from class: `StandAloneDataTypeManager`
    Get the path name associated with the storage of this stand alone datatype manager.
    Specified by:
      `getPath` in interface `FileBasedDataTypeManager`
    Overrides:
      `getPath` in class `StandAloneDataTypeManager`
    Returns:
      path name or null if not applicable

  - ### getType

    public ArchiveType getType()
    Description copied from interface: `DataTypeManager`
    Returns this manager's archive type
    Specified by:
      `getType` in interface `DataTypeManager`
    Overrides:
      `getType` in class `StandAloneDataTypeManager`
    Returns:
      the type

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`