java.util.Properties Maven / Gradle / Ivy
Show all versions of dragome-js-jre Show documentation
/*
* %W% %E%
*
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package java.util;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.Writer;
/**
* 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. Similarly,
* the call to the propertyNames
or list
method
* will fail if it is called on a "compromised" Properties
* object that contains a non-String
key.
*
*
* The {@link #load(java.io.Reader) load(Reader)} /
* {@link #store(java.io.Writer, java.lang.String) store(Writer, String)}
* methods load and store properties from and to a character based stream
* in a simple line-oriented format specified below.
*
* The {@link #load(java.io.InputStream) load(InputStream)} /
* {@link #store(java.io.OutputStream, java.lang.String) store(OutputStream, String)}
* methods work the same way as the load(Reader)/store(Writer, String) pair, except
* the input/output stream is encoded in ISO 8859-1 character encoding.
* Characters that cannot be directly represented in this encoding can be written using
* Unicode escapes
* ; only a single 'u' character is allowed in an escape
* sequence. The native2ascii tool can be used to convert property files to and
* from other character encodings.
*
*
The {@link #loadFromXML(InputStream)} and {@link
* #storeToXML(OutputStream, String, String)} methods load and store properties
* in a simple XML format. By default the UTF-8 character encoding is used,
* however a specific encoding may be specified if required. An XML properties
* document has the following DOCTYPE declaration:
*
*
* <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
*
* Note that the system URI (http://java.sun.com/dtd/properties.dtd) is
* not accessed when exporting or importing properties; it merely
* serves as a string to uniquely identify the DTD, which is:
*
* <?xml version="1.0" encoding="UTF-8"?>
*
* <!-- DTD for properties -->
*
* <!ELEMENT properties ( comment?, entry* ) >
*
* <!ATTLIST properties version CDATA #FIXED "1.0">
*
* <!ELEMENT comment (#PCDATA) >
*
* <!ELEMENT entry (#PCDATA) >
*
* <!ATTLIST entry key CDATA #REQUIRED>
*
*
* @see native2ascii tool for Solaris
* @see native2ascii tool for Windows
*
* This class is thread-safe: multiple threads can share a single
* Properties object without the need for external synchronization.
*
* @author Arthur van Hoff
* @author Michael McCloskey
* @author Xueming Shen
* @version %I%, %G%
* @since JDK1.0
*/
public class Properties extends Hashtable