    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.

##

defaults

##

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

##

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

##

defaults

      protected Properties defaults

##

Properties

      public Properties()

  Creates an empty property list.

Properties

      public Properties(Properties defaults)

  Creates an empty property list with specified defaults.

  Parameters:
    defaults - the defaults

##

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.

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.

getProperty

      public String getProperty(String key)

  Gets a property with the specified key. If the key is not found in this property list, tries the defaults. This method returns null if the property is not found.

  Parameters:
    key - the hashtable key

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, tries the defaults. This method returns defaultValue if the property is not found.

propertyNames

      public Enumeration propertyNames()

  Enumerates all the keys.

list

      public void list(PrintStream out)

  List properties, for debugging

list

      public void list(PrintWriter out)

  List properties, for debugging

    All Packages  Class Hierarchy  This Package  Previous  Next  Index