Package com.badlogic.gdx.utils
Class JsonReader
java.lang.Object
com.badlogic.gdx.utils.JsonReader
- All Implemented Interfaces:
BaseJsonReader
Lightweight JSON parser.
The default behavior is to parse the JSON into a DOM containing
The default behavior is to parse the JSON into a DOM containing
JsonValue
objects. Extend this class and override
methods to perform event driven parsing. When this is done, the parse methods will return null.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Called when a boolean value is encountered in the JSON.boolean
protected void
Called when a double value is encountered in the JSON.protected void
Called when a long value is encountered in the JSON.parse
(char[] data, int offset, int length) parse
(FileHandle file) parse
(InputStream input) protected void
pop()
Called when the end of an object or array is encountered in the JSON.protected void
startArray
(String name) Called when an array is encountered in the JSON.protected void
startObject
(String name) Called when an object is encountered in the JSON.void
stop()
Causes parsing to stop after the current or next object, array, or value.protected void
Called when a string value is encountered in the JSON.protected String
Called to unescape string values.
-
Constructor Details
-
JsonReader
public JsonReader()
-
-
Method Details
-
parse
-
parse
-
parse
- Specified by:
parse
in interfaceBaseJsonReader
-
parse
- Specified by:
parse
in interfaceBaseJsonReader
-
parse
-
stop
public void stop()Causes parsing to stop after the current or next object, array, or value. -
isStopped
public boolean isStopped() -
startObject
Called when an object is encountered in the JSON. -
startArray
Called when an array is encountered in the JSON. -
pop
protected void pop()Called when the end of an object or array is encountered in the JSON. -
string
Called when a string value is encountered in the JSON. -
number
Called when a double value is encountered in the JSON. -
number
Called when a long value is encountered in the JSON. -
bool
Called when a boolean value is encountered in the JSON. -
unescape
Called to unescape string values. The default implementation does standard JSON unescaping.
-