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.
The stream is written using the character encoding specified by
enc
.
Then every entry in this Properties
table is written out,
one per line. For each entry the key string is written, then an ASCII
=
, then the associated element string. Each character of
the element string is examined to see whether it should be rendered as
an escape sequence. Characters less than \u0020
and
characters greater than \u007E
are written as
\u
xxxx for
the appropriate hexadecimal value xxxx.
After the entries have been written, the output stream is flushed. The
output stream remains open after this method returns.
OutputStreamWriter awriter;
awriter = new OutputStreamWriter(out, enc);
// output in order.
for (int idx = 0; idx < props.size(); idx++) {
String key = props.getKeyAt(idx);
String val = props.getValueAt(idx);
if (enc.equals("ISO8859_1")) {
key = saveConvert(key);
val = saveConvert(val);
}
// don't forget the required space after the ":"
writeln(awriter, key + ": " + val);
}
awriter.flush();