| java.util.Properties org.w3c.util.XMLProperties
XMLProperties | public class XMLProperties extends Properties (Code) | | 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. Because Properties inherits from Hashtable, the
put and putAll methods can be applied to a Properties object. Their use
is strongly discouraged as they allow the caller to insert entries whose
keys or values are not Strings. The setProperty method should be used
instead. If the store or save method is called on a "compromised"
Properties object that contains a non-String key or value, the call will
fail.
This is a special implementation for XML :
<properties>
<key name="My_key1">My_Value1</key>
<key name="My_key2">My_Value2</key>
</properties>
version: $Revision: 1.5 $ author: Philippe Le Hégaret (plh@w3.org) author: Benoît Mahé (bmahe@w3.org) |
Method Summary | |
protected StringBuffer | encode(String string) | public synchronized void | load(InputStream in) Reads a property list from an input stream. | public synchronized void | load(File file) Reads a property list from an input stream. | public synchronized void | save(OutputStream out, String header) Calls the store(OutputStream out, String header) method
and suppresses IOExceptions that were thrown. | public void | setDebug(boolean debug) | public synchronized void | store(OutputStream out, String header) Writes this property list (key and element pairs) in this
Properties table to the output stream in a format suitable
for loading into a Properties table using the
load method.
After the entries have been written, the output stream is flushed. |
debug | public boolean debug(Code) | | |
XMLProperties | public XMLProperties()(Code) | | Creates an empty property list with no default values.
|
XMLProperties | public XMLProperties(Properties defaults)(Code) | | Creates an empty property list with the specified defaults.
Parameters: defaults - the defaults. |
XMLProperties | public XMLProperties(String parser, Properties defaults)(Code) | | Creates an empty property list with the specified defaults.
Parameters: parser - the XML Parser classname (default is PARSER_P) Parameters: defaults - the defaults. |
load | public synchronized void load(InputStream in) throws IOException(Code) | | Reads a property list from an input stream.
Parameters: in - the input stream. exception: IOException - if an error occurred when reading from theinput stream. since: JDK1.0 |
load | public synchronized void load(File file) throws IOException(Code) | | Reads a property list from an input stream. This method try to load
properties with super.load() if the XMLParser failed. Use this method
to translate an Property set to an XML Property set.
Parameters: file - the properties file. exception: IOException - if an error occurred when reading from theinput stream. since: JDK1.0 |
save | public synchronized void save(OutputStream out, String header)(Code) | | Calls the store(OutputStream out, String header) method
and suppresses IOExceptions that were thrown.
Parameters: out - an output stream. Parameters: header - a description of the property list. exception: ClassCastException - if this Properties objectcontains any keys or values that are not Strings . |
setDebug | public void setDebug(boolean debug)(Code) | | |
store | public synchronized void store(OutputStream out, String header) throws IOException(Code) | | Writes this property list (key and element pairs) in this
Properties table to the output stream in a format suitable
for loading into a Properties table using the
load method.
After the entries have been written, the output stream is flushed. The
output stream remains open after this method returns.
Parameters: out - an output stream. Parameters: header - a description of the property list. exception: ClassCastException - if this Properties objectcontains any keys or values that are not Strings . |
|
|