Package com.badlogic.gdx.utils
Class PropertiesUtils
- java.lang.Object
-
- com.badlogic.gdx.utils.PropertiesUtils
-
public final class PropertiesUtils extends java.lang.ObjectPropertiesUtilsis a helper class that allows you to load and store key/value pairs of anObjectMap<String,String>with the same line-oriented syntax supported byjava.util.Properties.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidload(ObjectMap<java.lang.String,java.lang.String> properties, java.io.Reader reader)Adds to the specifiedObjectMapthe key/value pairs loaded from theReaderin a simple line-oriented format compatible withjava.util.Properties.static voidstore(ObjectMap<java.lang.String,java.lang.String> properties, java.io.Writer writer, java.lang.String comment)Writes the key/value pairs of the specifiedObjectMapto the output character stream in a simple line-oriented format compatible withjava.util.Properties.
-
-
-
Method Detail
-
load
public static void load(ObjectMap<java.lang.String,java.lang.String> properties, java.io.Reader reader) throws java.io.IOException
Adds to the specifiedObjectMapthe key/value pairs loaded from theReaderin a simple line-oriented format compatible withjava.util.Properties.The input stream remains open after this method returns.
- Parameters:
properties- the map to be filled.reader- the input character stream reader.- Throws:
java.io.IOException- if an error occurred when reading from the input stream.java.lang.IllegalArgumentException- if a malformed Unicode escape appears in the input.
-
store
public static void store(ObjectMap<java.lang.String,java.lang.String> properties, java.io.Writer writer, java.lang.String comment) throws java.io.IOException
Writes the key/value pairs of the specifiedObjectMapto the output character stream in a simple line-oriented format compatible withjava.util.Properties.Every entry in the
ObjectMapis 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.
- Parameters:
properties- theObjectMap.writer- an output character stream writer.comment- an optional comment to be written, or null.- Throws:
java.io.IOException- if writing this property list to the specified output stream throws an IOException.java.lang.NullPointerException- ifwriteris null.
-
-