public class JSONReader extends Object
InputStream
and extracts characters and tokens from it.Modifier and Type | Field and Description |
---|---|
static Object |
NULL
It is sometimes more convenient and less ambiguous to have a
NULL object than to use Java's
null value. |
Constructor and Description |
---|
JSONReader(InputStream is)
Construct a JSONReader from an
InputStream . |
Modifier and Type | Method and Description |
---|---|
void |
arrayEnd()
End an array.
|
void |
arrayStart()
Start an array.
|
void |
mapEnd()
End a map.
|
void |
mapStart()
Start a map.
|
String |
nextKey()
Get the next key as String.
|
Object |
nextValue()
Get the next value.
|
char |
peek()
Get the first character of the next token.
|
public static final Object NULL
NULL
object than to use Java's
null
value. NULL.equals(null)
returns true
.
NULL.toString()
returns "null"
.public JSONReader(InputStream is)
InputStream
.is
- the InputStream.public void arrayEnd() throws JSONException
JSONException
- If syntax error.public void arrayStart() throws JSONException
JSONException
- If syntax error.public void mapEnd() throws JSONException
JSONException
- If syntax error.public void mapStart() throws JSONException
JSONException
- If syntax error.public String nextKey() throws JSONException
JSONException
- If syntax error.public Object nextValue() throws JSONException
Null
object.JSONException
- If syntax error.public char peek() throws JSONException
0
on EOF.JSONException
- on I/O error