Package com.badlogic.gdx.utils
Class UBJsonReader
- java.lang.Object
-
- com.badlogic.gdx.utils.UBJsonReader
-
- All Implemented Interfaces:
BaseJsonReader
public class UBJsonReader extends java.lang.Object implements BaseJsonReader
Lightweight UBJSON parser.
The default behavior is to parse the JSON into a DOM containingJsonValue
objects. Extend this class and override methods to perform event driven parsing. When this is done, the parse methods will return null.
-
-
Field Summary
Fields Modifier and Type Field Description boolean
oldFormat
-
Constructor Summary
Constructors Constructor Description UBJsonReader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JsonValue
parse(FileHandle file)
JsonValue
parse(java.io.DataInputStream din)
protected JsonValue
parse(java.io.DataInputStream din, byte type)
JsonValue
parse(java.io.InputStream input)
Parses the UBJSON from the given stream.protected JsonValue
parseArray(java.io.DataInputStream din)
protected JsonValue
parseData(java.io.DataInputStream din, byte blockType)
protected JsonValue
parseObject(java.io.DataInputStream din)
protected long
parseSize(java.io.DataInputStream din, boolean useIntOnError, long defaultValue)
protected long
parseSize(java.io.DataInputStream din, byte type, boolean useIntOnError, long defaultValue)
protected java.lang.String
parseString(java.io.DataInputStream din, boolean sOptional, byte type)
protected java.lang.String
parseString(java.io.DataInputStream din, byte type)
protected java.lang.String
readString(java.io.DataInputStream din, long size)
protected short
readUChar(java.io.DataInputStream din)
protected long
readUInt(java.io.DataInputStream din)
protected int
readUShort(java.io.DataInputStream din)
-
-
-
Method Detail
-
parse
public JsonValue parse(java.io.InputStream input)
Parses the UBJSON from the given stream.
For best performance you should provide buffered streams to this method!- Specified by:
parse
in interfaceBaseJsonReader
-
parse
public JsonValue parse(FileHandle file)
- Specified by:
parse
in interfaceBaseJsonReader
-
parse
public JsonValue parse(java.io.DataInputStream din) throws java.io.IOException
- Throws:
java.io.IOException
-
parse
protected JsonValue parse(java.io.DataInputStream din, byte type) throws java.io.IOException
- Throws:
java.io.IOException
-
parseArray
protected JsonValue parseArray(java.io.DataInputStream din) throws java.io.IOException
- Throws:
java.io.IOException
-
parseObject
protected JsonValue parseObject(java.io.DataInputStream din) throws java.io.IOException
- Throws:
java.io.IOException
-
parseData
protected JsonValue parseData(java.io.DataInputStream din, byte blockType) throws java.io.IOException
- Throws:
java.io.IOException
-
parseString
protected java.lang.String parseString(java.io.DataInputStream din, byte type) throws java.io.IOException
- Throws:
java.io.IOException
-
parseString
protected java.lang.String parseString(java.io.DataInputStream din, boolean sOptional, byte type) throws java.io.IOException
- Throws:
java.io.IOException
-
parseSize
protected long parseSize(java.io.DataInputStream din, boolean useIntOnError, long defaultValue) throws java.io.IOException
- Throws:
java.io.IOException
-
parseSize
protected long parseSize(java.io.DataInputStream din, byte type, boolean useIntOnError, long defaultValue) throws java.io.IOException
- Throws:
java.io.IOException
-
readUChar
protected short readUChar(java.io.DataInputStream din) throws java.io.IOException
- Throws:
java.io.IOException
-
readUShort
protected int readUShort(java.io.DataInputStream din) throws java.io.IOException
- Throws:
java.io.IOException
-
readUInt
protected long readUInt(java.io.DataInputStream din) throws java.io.IOException
- Throws:
java.io.IOException
-
readString
protected java.lang.String readString(java.io.DataInputStream din, long size) throws java.io.IOException
- Throws:
java.io.IOException
-
-