Package ghidra.util
Class PropertyFile
- java.lang.Object
- 
- ghidra.util.PropertyFile
 
- 
- Direct Known Subclasses:
- IndexedPropertyFile
 
 public class PropertyFile extends java.lang.ObjectClass that represents a file of property names and values. The file extension used is PROPERTY_EXT.
- 
- 
Field SummaryFields Modifier and Type Field Description protected java.lang.Stringnameprotected java.lang.StringparentPathstatic java.lang.StringPROPERTY_EXTFile extension indicating the file is a property file.protected java.io.FilepropertyFileprotected java.lang.StringstorageName
 - 
Constructor SummaryConstructors Constructor Description PropertyFile(java.io.File dir, java.lang.String storageName, java.lang.String parentPath, java.lang.String name)Construct a new or existing PropertyFile.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddelete()Delete the file for this PropertyFile.booleanequals(java.lang.Object obj)booleanexists()Return whether the file for this PropertyFile exists.booleangetBoolean(java.lang.String propertyName, boolean defaultValue)Return the boolean value with the given propertyName.java.lang.StringgetFileID()Returns the FileID associated with this file.java.io.FilegetFolder()Return the parent file to this PropertyFile.intgetInt(java.lang.String propertyName, int defaultValue)Return the int value with the given propertyName.longgetLong(java.lang.String propertyName, long defaultValue)Return the long value with the given propertyName.java.lang.StringgetName()Return the name of this PropertyFile.java.lang.StringgetParentPath()Return the path to the parent of this PropertyFile.java.lang.StringgetPath()Return the path to this PropertyFile.java.lang.StringgetStorageName()Return the storage name of this PropertyFile.java.lang.StringgetString(java.lang.String propertyName, java.lang.String defaultValue)Return the string value with the given propertyName.inthashCode()booleanisReadOnly()Returns true if file is writablelonglastModified()Return the time of last modification in number of milliseconds.voidmoveTo(java.io.File newParent, java.lang.String newStorageName, java.lang.String newParentPath, java.lang.String newName)Move this PropertyFile to the newParent file.voidputBoolean(java.lang.String propertyName, boolean value)Assign the boolean value to the given propertyName.voidputInt(java.lang.String propertyName, int value)Assign the int value to the given propertyName.voidputLong(java.lang.String propertyName, long value)Assign the long value to the given propertyName.voidputString(java.lang.String propertyName, java.lang.String value)Assign the string value to the given propertyName.voidreadState()Read in this PropertyFile into a SaveState object.voidremove(java.lang.String propertyName)Remove the specified propertyvoidsetFileID(java.lang.String fileId)Set the FileID associated with this file.voidwriteState()Write the contents of this PropertyFile.
 
- 
- 
- 
Field Detail- 
PROPERTY_EXTpublic static final java.lang.String PROPERTY_EXT File extension indicating the file is a property file.- See Also:
- Constant Field Values
 
 - 
propertyFileprotected java.io.File propertyFile 
 - 
storageNameprotected java.lang.String storageName 
 - 
parentPathprotected java.lang.String parentPath 
 - 
nameprotected java.lang.String name 
 
- 
 - 
Constructor Detail- 
PropertyFilepublic PropertyFile(java.io.File dir, java.lang.String storageName, java.lang.String parentPath, java.lang.String name) throws java.io.IOExceptionConstruct a new or existing PropertyFile. This form ignores retained property values for NAME and PARENT path.- Parameters:
- dir- parent directory
- storageName- stored property file name (without extension)
- parentPath- path to parent
- name- name of the property file
- Throws:
- java.io.IOException
 
 
- 
 - 
Method Detail- 
getNamepublic java.lang.String 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.
 - 
isReadOnlypublic boolean isReadOnly() Returns true if file is writable
 - 
getPathpublic java.lang.String 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.
 - 
getParentPathpublic java.lang.String getParentPath() Return the path to the parent of this PropertyFile.
 - 
getFolderpublic java.io.File getFolder() Return the parent file to this PropertyFile.
 - 
getStorageNamepublic java.lang.String getStorageName() Return the storage name of this PropertyFile. This name does not include the property file extension (.prp)
 - 
getFileIDpublic java.lang.String getFileID() Returns the FileID associated with this file.
 - 
setFileIDpublic void setFileID(java.lang.String fileId) Set the FileID associated with this file.- Parameters:
- fileId-
 
 - 
getIntpublic int getInt(java.lang.String propertyName, int defaultValue)Return the int value with the given propertyName.- Parameters:
- propertyName- name of property that is an int
- defaultValue- value to use if the property does not exist
- Returns:
- int value
 
 - 
putIntpublic void putInt(java.lang.String propertyName, int value)Assign the int value to the given propertyName.- Parameters:
- propertyName- name of property to set
- value- value to set
 
 - 
getLongpublic long getLong(java.lang.String propertyName, long defaultValue)Return the long value with the given propertyName.- Parameters:
- propertyName- name of property that is a long
- defaultValue- value to use if the property does not exist
- Returns:
- long value
 
 - 
putLongpublic void putLong(java.lang.String propertyName, long value)Assign the long value to the given propertyName.- Parameters:
- propertyName- name of property to set
- value- value to set
 
 - 
getStringpublic java.lang.String getString(java.lang.String propertyName, java.lang.String defaultValue)Return the string value with the given propertyName.- Parameters:
- propertyName- name of property that is a string
- defaultValue- value to use if the property does not exist
- Returns:
- string value
 
 - 
putStringpublic void putString(java.lang.String propertyName, java.lang.String value)Assign the string value to the given propertyName.- Parameters:
- propertyName- name of property to set
- value- value to set
 
 - 
getBooleanpublic boolean getBoolean(java.lang.String propertyName, boolean defaultValue)Return the boolean value with the given propertyName.- Parameters:
- propertyName- name of property that is a boolean
- defaultValue- value to use if the property does not exist
- Returns:
- boolean value
 
 - 
putBooleanpublic void putBoolean(java.lang.String propertyName, boolean value)Assign the boolean value to the given propertyName.- Parameters:
- propertyName- name of property to set
- value- value to set
 
 - 
removepublic void remove(java.lang.String propertyName) Remove the specified property- Parameters:
- propertyName-
 
 - 
lastModifiedpublic long lastModified() Return the time of last modification in number of milliseconds.
 - 
writeStatepublic void writeState() throws java.io.IOExceptionWrite the contents of this PropertyFile.- Throws:
- java.io.IOException- thrown if there was a problem writing the file
 
 - 
readStatepublic void readState() throws java.io.IOExceptionRead in this PropertyFile into a SaveState object.- Throws:
- java.io.IOException- thrown if there was a problem reading the file
 
 - 
moveTopublic void moveTo(java.io.File newParent, java.lang.String newStorageName, java.lang.String newParentPath, java.lang.String newName) throws DuplicateFileException, java.io.IOExceptionMove this PropertyFile to the newParent file.- Parameters:
- newParent- new parent of the file
- newStorageName- new storage name
- newParentPath- parent path of the new parent
- newName- new name for this PropertyFile
- Throws:
- java.io.IOException- thrown if there was a problem accessing the
- DuplicateFileException- thrown if a file with the newName already exists
 
 - 
existspublic boolean exists() Return whether the file for this PropertyFile exists.
 - 
deletepublic void delete() Delete the file for this PropertyFile.
 - 
hashCodepublic int hashCode() - Overrides:
- hashCodein class- java.lang.Object
 
 - 
equalspublic boolean equals(java.lang.Object obj) - Overrides:
- equalsin class- java.lang.Object
 
 
- 
 
-