|
Homepage | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.util.Dictionary | +--java.util.Hashtable | +--java.util.Properties | +--netx.jnlp.util.PropertiesFile
A properties object backed by a specified file without throwing exceptions. The properties are automatically loaded from the file when the first property is requested, but the save method must be called before changes are saved to the file.
This class does not report IO exceptions.
Field Summary | |
(package private) java.io.File |
file
the file to save to |
(package private) java.lang.String |
header
the header string |
(package private) boolean |
loaded
lazy loaded on getProperty |
Fields inherited from class java.util.Properties |
defaults |
Constructor Summary | |
PropertiesFile(java.io.File file)
Create a properties object backed by the specified file. |
|
PropertiesFile(java.io.File file,
java.lang.String header)
Create a properties object backed by the specified file. |
Method Summary | |
java.lang.String |
getProperty(java.lang.String key)
Returns the value of the specified key, or null if the key does not exist. |
java.lang.String |
getProperty(java.lang.String key,
java.lang.String defaultValue)
Returns the value of the specified key, or the default value if the key does not exist. |
java.io.File |
getStoreFile()
Returns the file backing this properties object. |
void |
load()
Ensures that the file backing these properties has been loaded; call this method before calling any method defined by a superclass. |
java.lang.Object |
setProperty(java.lang.String key,
java.lang.String value)
Sets the value for the specified key. |
void |
store()
Saves the properties to the file. |
Methods inherited from class java.util.Properties |
list, list, load, propertyNames, save, store |
Methods inherited from class java.util.Hashtable |
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
java.io.File file
java.lang.String header
boolean loaded
Constructor Detail |
public PropertiesFile(java.io.File file)
file
- the file to save and load topublic PropertiesFile(java.io.File file, java.lang.String header)
file
- the file to save and load toheader
- the file headerMethod Detail |
public java.lang.String getProperty(java.lang.String key)
getProperty
in class java.util.Properties
public java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue)
getProperty
in class java.util.Properties
public java.lang.Object setProperty(java.lang.String key, java.lang.String value)
setProperty
in class java.util.Properties
public java.io.File getStoreFile()
public void load()
public void store()
|
Homepage | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |