Package ghidra.util
Class PropertyFile
java.lang.Object
ghidra.util.PropertyFile
- Direct Known Subclasses:
IndexedPropertyFile
Class that represents a file of property names and values. The file
extension used is PROPERTY_EXT.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionPropertyFile
(File dir, String storageName, String parentPath, String name) Construct a new or existing PropertyFile. -
Method Summary
Modifier and TypeMethodDescriptionvoid
delete()
Delete the file for this PropertyFile.boolean
boolean
exists()
Return whether the file for this PropertyFile exists.boolean
getBoolean
(String propertyName, boolean defaultValue) Return the boolean value with the given propertyName.Returns the FileID associated with this file.Return the parent file to this PropertyFile.int
Return the int value with the given propertyName.long
Return the long value with the given propertyName.getName()
Return the name of this PropertyFile.Return the path to the parent of this PropertyFile.getPath()
Return the path to this PropertyFile.Return the storage name of this PropertyFile.Return the string value with the given propertyName.int
hashCode()
boolean
Returns true if file is writablelong
Return the time of last modification in number of milliseconds.void
Move this PropertyFile to the newParent file.void
putBoolean
(String propertyName, boolean value) Assign the boolean value to the given propertyName.void
Assign the int value to the given propertyName.void
Assign the long value to the given propertyName.void
Assign the string value to the given propertyName.void
Read in this PropertyFile into a SaveState object.void
Remove the specified propertyvoid
Set the FileID associated with this file.void
Write the contents of this PropertyFile.
-
Field Details
-
PROPERTY_EXT
File extension indicating the file is a property file.- See Also:
-
propertyFile
-
storageName
-
parentPath
-
name
-
-
Constructor Details
-
PropertyFile
public PropertyFile(File dir, String storageName, String parentPath, String name) throws IOException Construct a new or existing PropertyFile. This form ignores retained property values for NAME and PARENT path.- Parameters:
dir
- parent directorystorageName
- stored property file name (without extension)parentPath
- path to parentname
- name of the property file- Throws:
IOException
-
-
Method Details
-
getName
Return the name of this PropertyFile. A null value may be returned if this is an older property file and the name was not specified at time of construction. -
isReadOnly
public boolean isReadOnly()Returns true if file is writable -
getPath
Return the path to this PropertyFile. A null value may be returned if this is an older property file and the name and parentPath was not specified at time of construction. -
getParentPath
Return the path to the parent of this PropertyFile. -
getFolder
Return the parent file to this PropertyFile. -
getStorageName
Return the storage name of this PropertyFile. This name does not include the property file extension (.prp) -
getFileID
Returns the FileID associated with this file.- Returns:
- FileID associated with this file
-
setFileID
Set the FileID associated with this file.- Parameters:
fileId
-
-
getInt
Return the int value with the given propertyName.- Parameters:
propertyName
- name of property that is an intdefaultValue
- value to use if the property does not exist- Returns:
- int value
-
putInt
Assign the int value to the given propertyName.- Parameters:
propertyName
- name of property to setvalue
- value to set
-
getLong
Return the long value with the given propertyName.- Parameters:
propertyName
- name of property that is a longdefaultValue
- value to use if the property does not exist- Returns:
- long value
-
putLong
Assign the long value to the given propertyName.- Parameters:
propertyName
- name of property to setvalue
- value to set
-
getString
Return the string value with the given propertyName.- Parameters:
propertyName
- name of property that is a stringdefaultValue
- value to use if the property does not exist- Returns:
- string value
-
putString
Assign the string value to the given propertyName.- Parameters:
propertyName
- name of property to setvalue
- value to set
-
getBoolean
Return the boolean value with the given propertyName.- Parameters:
propertyName
- name of property that is a booleandefaultValue
- value to use if the property does not exist- Returns:
- boolean value
-
putBoolean
Assign the boolean value to the given propertyName.- Parameters:
propertyName
- name of property to setvalue
- value to set
-
remove
Remove the specified property- Parameters:
propertyName
-
-
lastModified
public long lastModified()Return the time of last modification in number of milliseconds. -
writeState
Write the contents of this PropertyFile.- Throws:
IOException
- thrown if there was a problem writing the file
-
readState
Read in this PropertyFile into a SaveState object.- Throws:
IOException
- thrown if there was a problem reading the file
-
moveTo
public void moveTo(File newParent, String newStorageName, String newParentPath, String newName) throws DuplicateFileException, IOException Move this PropertyFile to the newParent file.- Parameters:
newParent
- new parent of the filenewStorageName
- new storage namenewParentPath
- parent path of the new parentnewName
- new name for this PropertyFile- Throws:
IOException
- thrown if there was a problem accessing theDuplicateFileException
- thrown if a file with the newName already exists
-
exists
public boolean exists()Return whether the file for this PropertyFile exists. -
delete
public void delete()Delete the file for this PropertyFile. -
hashCode
public int hashCode() -
equals
-