Package ghidra.util
Class PropertyFile
java.lang.Object
ghidra.util.PropertyFile
- Direct Known Subclasses:
ItemPropertyFile
ItemPropertyFile provides basic property storage. The file extension
used is PROPERTY_EXT.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPropertyFile(File dir, String storageName) Construct a new or existing PropertyFile. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanvoiddelete()Delete the file for this PropertyFile.booleanbooleanexists()Return whether the file for this PropertyFile exists.booleangetBoolean(String propertyName, boolean defaultValue) Return the boolean value with the given propertyName.intReturn the int value with the given propertyName.longReturn the long value with the given propertyName.Returns the native parent storage directory containing this PropertyFile..Return the native storage name for this PropertyFile.Return the string value with the given propertyName.inthashCode()booleanReturns true if file is read-only as reported by underlying native file-system.longReturn the time of last modification in number of millisecondsvoidMove this PropertyFile to the newParent file.voidputBoolean(String propertyName, boolean value) Assign the boolean value to the given propertyName.voidAssign the int value to the given propertyName.voidAssign the long value to the given propertyName.voidAssign the string value to the given propertyName.voidRead in this PropertyFile into a SaveState object.voidRemove the specified propertyvoidWrite the contents of this PropertyFile.
-
Field Details
-
PROPERTY_EXT
File extension indicating the file is a property file.- See Also:
-
propertyFile
-
storageName
-
-
Constructor Details
-
PropertyFile
Construct a new or existing PropertyFile. This constructor ignores retained property values for NAME and PARENT path. This constructor will not throw an exception if the file does not exist.- Parameters:
dir- native directory where this file is storedstorageName- stored property file name (without extension)- Throws:
InvalidObjectException- if a file parse error occursIOException- if an IO error occurs reading an existing file
-
-
Method Details
-
contains
-
isReadOnly
public boolean isReadOnly()Returns true if file is read-only as reported by underlying native file-system.- Returns:
- true if file is read-only as reported by underlying native file-system
-
getParentStorageDirectory
Returns the native parent storage directory containing this PropertyFile..- Returns:
- the native parent storage directory containing this PropertyFile.
-
getStorageName
Return the native storage name for this PropertyFile. This name does not include the property file extension (.prp)- Returns:
- native storage name
-
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- name of property to be removed
-
lastModified
public long lastModified()Return the time of last modification in number of milliseconds- Returns:
- time of last modification
-
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:
InvalidObjectException- if a file parse error occursIOException- thrown if there was a problem reading the file
-
moveTo
public void moveTo(File newStorageParent, String newStorageName) throws DuplicateFileException, IOException Move this PropertyFile to the newParent file.- Parameters:
newStorageParent- new storage parent of the native filenewStorageName- new storage name for this property file- 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.- Returns:
- true if this file exists
-
delete
public void delete()Delete the file for this PropertyFile. -
hashCode
public int hashCode() -
equals
-