public final class PropertiesUtils extends Object
PropertiesUtils is a helper class that allows you to load and store key/value pairs of an
ObjectMap<String,String> with the same line-oriented syntax supported by java.util.Properties.| Modifier and Type | Method and Description |
|---|---|
static void |
load(ObjectMap<String,String> properties,
Reader reader)
Adds to the specified
ObjectMap the key/value pairs loaded from the Reader in a simple line-oriented format
compatible with java.util.Properties. |
static void |
store(ObjectMap<String,String> properties,
Writer writer,
String comment)
Writes the key/value pairs of the specified
ObjectMap to the output character stream in a simple line-oriented
format compatible with java.util.Properties. |
public static void load(ObjectMap<String,String> properties, Reader reader) throws IOException
ObjectMap the key/value pairs loaded from the Reader in a simple line-oriented format
compatible with java.util.Properties.
The input stream remains open after this method returns.
properties - the map to be filled.reader - the input character stream reader.IOException - if an error occurred when reading from the input stream.IllegalArgumentException - if a malformed Unicode escape appears in the input.public static void store(ObjectMap<String,String> properties, Writer writer, String comment) throws IOException
ObjectMap to the output character stream in a simple line-oriented
format compatible with java.util.Properties.
Every entry in the ObjectMap is written out, one per line. For each entry the key string is written, then an
ASCII =, then the associated element string. For the key, all space characters are written with a preceding
\ character. For the element, leading space characters, but not embedded or trailing space characters, are
written with a preceding \ character. The key and element characters #, !,
=, and : are written with a preceding backslash to ensure that they are properly loaded.
After the entries have been written, the output stream is flushed. The output stream remains open after this method returns.
properties - the ObjectMap.writer - an output character stream writer.comment - an optional comment to be written, or null.IOException - if writing this property list to the specified output stream throws an IOException.NullPointerException - if writer is null.Copyright © 2021. All rights reserved.