APIdia Launch Partner
Top Description Fields Constructors Methods
com.badlogic.gdx.utils

public final Class PropertiesUtils

extends Object
Class Inheritance
Imports
java.io.BufferedReader, .IOException, .Reader, .Writer, java.util.Date, com.badlogic.gdx.utils.ObjectMap.Entry

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.

Field Summary

Modifier and TypeField and Description
private static final int
private static final int
private static final int
private static final String
private static final int
private static final int
private static final int

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static void
dumpString(StringBuilder outBuffer, String string, boolean escapeSpace, boolean escapeUnicode)

public static void
load(ObjectMap<String, String>
the map to be filled.
properties
,
Reader
the input character stream 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.

public static void
store(ObjectMap<String, String>
the ObjectMap.
properties
,
Writer
an output character stream writer.
writer
,
String
an optional comment to be written, or null.
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.

private static void
storeImpl(ObjectMap<String, String> properties, Writer writer, String comment, boolean escapeUnicode)

private static void
writeComment(Writer writer, String comment)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CONTINUEback to summary
private static final int CONTINUE
IGNOREback to summary
private static final int IGNORE
KEY_DONEback to summary
private static final int KEY_DONE
LINE_SEPARATORback to summary
private static final String LINE_SEPARATOR
NONEback to summary
private static final int NONE
SLASHback to summary
private static final int SLASH
UNICODEback to summary
private static final int UNICODE

Constructor Detail

PropertiesUtilsback to summary
private PropertiesUtils()

Method Detail

dumpStringback to summary
private static void dumpString(StringBuilder outBuffer, String string, boolean escapeSpace, boolean escapeUnicode)
loadback to summary
public static void load(ObjectMap<String, String> properties, Reader reader) throws IOException

Adds to the specified 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.

Parameters
properties:ObjectMap<String, String>

the map to be filled.

reader:Reader

the input character stream reader.

Annotations
@SuppressWarnings:deprecation
Exceptions
IOException:
if an error occurred when reading from the input stream.
IllegalArgumentException:
if a malformed Unicode escape appears in the input.
storeback to summary
public static void store(ObjectMap<String, String> properties, Writer writer, String comment) throws IOException

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.

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.

Parameters
properties:ObjectMap<String, String>

the ObjectMap.

writer:Writer

an output character stream writer.

comment:String

an optional comment to be written, or null.

Exceptions
IOException:
if writing this property list to the specified output stream throws an IOException.
NullPointerException:
if writer is null.
storeImplback to summary
private static void storeImpl(ObjectMap<String, String> properties, Writer writer, String comment, boolean escapeUnicode) throws IOException
writeCommentback to summary
private static void writeComment(Writer writer, String comment) throws IOException