java.util.Properties
Properties is a Hashtable where the keys and values must be Strings. Each
Properties can have a default Properties which specifies the default values
which are used if the key is not in this Properties.
Known Direct Subclasses
Known Indirect Subclasses
Summary
Fields
Public Constructors
Public Methods
clear,
clone,
contains,
containsKey,
containsValue,
elements,
entrySet,
equals,
get,
hashCode,
isEmpty,
keySet,
keys,
put,
putAll,
rehash,
remove,
size,
toString,
values
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
Methods inherited
from interface
java.util.Map
clear,
containsKey,
containsValue,
entrySet,
equals,
get,
hashCode,
isEmpty,
keySet,
put,
putAll,
remove,
size,
values
Details
Fields
The default values for this Properties.
Public Constructors
public
Properties()
Constructs a new Properties object.
public
Properties(Properties properties)
Constructs a new Properties object using the specified default
properties.
Parameters
properties
| the default properties
|
Public Methods
public
String
getProperty(String name, String defaultValue)
Searches for the property with the specified name. If the property is not
found, look in the default properties. If the property is not found in
the default properties, answer the specified default.
Parameters
name
| the name of the property to find |
defaultValue
| the default value |
public
String
getProperty(String name)
Searches for the property with the specified name. If the property is not
found, look in the default properties. If the property is not found in
the default properties, answer null.
Parameters
name
| the name of the property to find |
Lists the mappings in this Properties to the specified PrintStream in a
human readable form.
public
void
list(PrintWriter writer)
Lists the mappings in this Properties to the specified PrintWriter in a
human readable form.
public
synchronized
void
load(InputStream in)
Loads properties from the specified InputStream. The properties are of
the form
key=value
, one property per line.
public
Enumeration<?>
propertyNames()
Returns all of the property names that this Properties contains.
Returns
- an Enumeration containing the names of all properties
This method is deprecated.
Does not throw an IOException, use store(OutputStream, String)
Saves the mappings in this Properties to the specified OutputStream,
putting the specified comment at the beginning. The output from this
method is suitable for being read by the load() method.
Parameters
out
| the OutputStream |
comment
| the comment |
Maps the specified key to the specified value. If the key already exists,
the old value is replaced. The key and value cannot be null.
Parameters
name
| the key |
value
| the value |
Returns
- the old value mapped to the key, or null
public
synchronized
void
store(OutputStream out, String comment)
Stores the mappings in this Properties to the specified OutputStream,
putting the specified comment at the beginning. The output from this
method is suitable for being read by the load() method.
Parameters
out
| the OutputStream |
comment
| the comment |