Class java.util.Properties
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class java.util.Properties

java.lang.Object
   |
   +----java.util.Dictionary
           |
           +----java.util.Hashtable
                   |
                   +----java.util.Properties

public class Properties
extends Hashtable
Persistent properties class. This class is basically a hashtable that can be saved/loaded from a stream. If a property is not found, a property list containing defaults is searched. This allows arbitrary nesting.

Variable Index

 o defaults

Constructor Index

 o Properties()
Creates an empty property list.
 o Properties(Properties)
Creates an empty property list with specified defaults.

Method Index

 o getProperty(String)
Gets a property with the specified key.
 o getProperty(String, String)
Gets a property with the specified key and default.
 o list(PrintStream)
List properties, for debugging
 o load(InputStream)
Loads properties from an InputStream.
 o propertyNames()
Enumerates all the keys.
 o save(OutputStream, String)
Save properties to an OutputStream.

Variables

 o defaults
  protected Properties defaults

Constructors

 o Properties
  public Properties()
Creates an empty property list.
 o Properties
  public Properties(Properties defaults)
Creates an empty property list with specified defaults.
Parameters:
defaults - the defaults

Methods

 o load
  public synchronized void load(InputStream in) throws IOException
Loads properties from an InputStream.
Parameters:
in - the input stream
Throws: IOException
Error when reading from input stream.
 o save
  public synchronized void save(OutputStream out,
                                String header)
Save properties to an OutputStream. Use the header as a comment at the top of the file.
 o getProperty
  public String getProperty(String key)
Gets a property with the specified key. If the key is not found in this property list, try the defaults. This method returns null if the property is not found.
Parameters:
key - the hashtable key
 o getProperty
  public String getProperty(String key,
                            String defaultValue)
Gets a property with the specified key and default. If the key is not found in this property list, try the defaults. This method returns def if the property is not found.
 o propertyNames
  public Enumeration propertyNames()
Enumerates all the keys.
 o list
  public void list(PrintStream out)
List properties, for debugging

All Packages  Class Hierarchy  This Package  Previous  Next  Index