Class java.util.Properties
All Packages Class Hierarchy This Package Previous Next Index
Class java.util.Properties
Object
|
+----Dictionary
|
+----Hashtable
|
+----java.util.Properties
- public class Properties
- extends Hashtable
The Properties
class represents a persistent set of
properties. The Properties
can be saved to a stream
or loaded from a stream. Each key and its corresponding value in
the property list is a string.
A property list can contain another property list as its
"defaults"; this second property list is searched if
the property key is not found in the original property list.
- Version:
- 1.31, 07/01/98
- Author:
- Arthur van Hoff
- Since:
- JDK1.0
-
defaults
- A property list that contains default values for any keys not
found in this property list.
-
java.util.Properties()
- Creates an empty property list with no default values.
-
java.util.Properties(Properties)
- Creates an empty property list with the specified defaults.
-
getProperty(String)
- Searches for the property with the specified key in this property list.
-
getProperty(String, String)
- Searches for the property with the specified key in this property list.
-
list(PrintStream)
- Prints this property list out to the specified output stream.
-
list(PrintWriter)
- Prints this property list out to the specified output stream.
-
load(InputStream)
- Reads a property list from an input stream.
-
propertyNames()
- Returns an enumeration of all the keys in this property list, including
the keys in the default property list.
-
save(OutputStream, String)
- Stores this property list to the specified output stream.
defaults
protected java.util.Properties defaults
- A property list that contains default values for any keys not
found in this property list.
- Since:
JDK1.0
Properties
public Properties()
- Creates an empty property list with no default values.
- Since:
- JDK1.0
Properties
public Properties(Properties defaults)
- Creates an empty property list with the specified defaults.
- Parameters:
- defaults - the defaults.
- Since:
- JDK1.0
getProperty
public java.lang.String getProperty(String key)
- Searches for the property with the specified key in this property list.
If the key is not found in this property list, the default property list,
and its defaults, recursively, are then checked. The method returns
null
if the property is not found.
- Parameters:
- key - the property key.
- Returns:
- the value in this property list with the specified key value.
- Since:
- JDK1.0
- See Also:
- defaults
getProperty
public java.lang.String getProperty(String key,
String defaultValue)
- Searches for the property with the specified key in this property list.
If the key is not found in this property list, the default property list,
and its defaults, recursively, are then checked. The method returns the
default value argument if the property is not found.
- Parameters:
- key - the hashtable key.
- defaultValue - a default value.
- Returns:
- the value in this property list with the specified key value.
- Since:
- JDK1.0
- See Also:
- defaults
list
public void list(PrintStream out)
- Prints this property list out to the specified output stream.
This method is useful for debugging.
- Parameters:
- out - an output stream.
- Since:
- JDK1.0
list
public void list(PrintWriter out)
- Prints this property list out to the specified output stream.
This method is useful for debugging.
- Parameters:
- out - an output stream.
- Since:
- JDK1.1
load
public synchronized void load(InputStream in) throws IOException
- Reads a property list from an input stream.
- Parameters:
- in - the input stream.
- Throws: IOException
- if an error occurred when reading from the
input stream.
- Since:
- JDK1.0
propertyNames
public java.util.Enumeration propertyNames()
- Returns an enumeration of all the keys in this property list, including
the keys in the default property list.
- Returns:
- an enumeration of all the keys in this property list, including
the keys in the default property list.
- Since:
- JDK1.0
- See Also:
- Enumeration, defaults
save
public synchronized void save(OutputStream out,
String header)
- Stores this property list to the specified output stream. The
string header is printed as a comment at the beginning of the stream.
- Parameters:
- out - an output stream.
- header - a description of the property list.
- Since:
- JDK1.0
All Packages Class Hierarchy This Package Previous Next Index