Class Properties
String keys and values, a second table of defaults behind them, and the
.properties text format.
The format is read as the JDK reads it: # and ! comments, =, : or
white space between key and value, a trailing backslash continuing a line
(the next line's indentation dropped), and the escapes \t, \n, \r,
\f and backslash-u followed by four hexadecimal digits; a backslash
before any other character stands for that character. A stream is
ISO 8859-1; a reader is whatever its characters are. store(OutputStream, String) writes text
that load(InputStream) reads back to the same table, escaping what the format
requires and, on a stream, every character outside printable ASCII.
The XML form (loadFromXML, storeToXML) and list are not provided.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected PropertiesThe table consulted for a key this one does not have, or null. -
Constructor Summary
ConstructorsConstructorDescriptionAn empty table with no defaults.Properties(Properties defaults) An empty table withdefaultsbehind it. -
Method Summary
Modifier and TypeMethodDescriptiongetProperty(String name) The value fornamehere, else in the defaults, else null.getProperty(String name, String defaultValue) voidload(InputStream in) Reads ISO 8859-1.propertiestext, adding to what is here.voidReads.propertiestext, adding to what is here.Enumeration<?> Every key of this table and of its defaults.voidsave(OutputStream out, String comments) Deprecated.setProperty(String name, String value) Mapsnametovaluein this table, answering the value it replaced.voidstore(OutputStream out, String comments) Writes this table (not its defaults) as ISO 8859-1.propertiestext: the comment lines, a line with the current date, then onekey=valueline per entry.voidWrites this table as.propertiestext, leaving characters outside ASCII as they are.The keys, of this table and of its defaults, whose key and value are both strings.Methods inherited from class Hashtable
clear, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, valuesMethods inherited from interface Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
defaults
The table consulted for a key this one does not have, or null.
-
-
Constructor Details
-
Properties
public Properties()An empty table with no defaults. -
Properties
An empty table withdefaultsbehind it.
-
-
Method Details
-
getProperty
-
getProperty
-
setProperty
-
load
Reads ISO 8859-1.propertiestext, adding to what is here. The stream is left open.- Throws:
IOException
-
load
Reads.propertiestext, adding to what is here. The reader is left open.- Throws:
IOException
-
propertyNames
Every key of this table and of its defaults. -
stringPropertyNames
-
save
Deprecated.Writes this table as
store(OutputStream, String)does, ignoring anyIOException.Deprecated
An error writing is lost; use
store(OutputStream, String). -
store
Writes this table (not its defaults) as ISO 8859-1
.propertiestext: the comment lines, a line with the current date, then onekey=valueline per entry. The stream is flushed and left open.Throws
ClassCastException: if a key or value is not aString
- Throws:
IOException
-
store
Writes this table as
.propertiestext, leaving characters outside ASCII as they are. The writer is flushed and left open.Throws
ClassCastException: if a key or value is not aString
- Throws:
IOException
-