public final class JsonTreeReader extends JsonReader
| Modifier and Type | Field and Description |
|---|---|
private int[] |
pathIndices |
private java.lang.String[] |
pathNames |
private static java.lang.Object |
SENTINEL_CLOSED |
private java.lang.Object[] |
stack |
private int |
stackSize |
private static java.io.Reader |
UNREADABLE_READER |
| Constructor and Description |
|---|
JsonTreeReader(JsonElement element) |
| Modifier and Type | Method and Description |
|---|---|
void |
beginArray()
Consumes the next token from the JSON stream and asserts that it is the
beginning of a new array.
|
void |
beginObject()
Consumes the next token from the JSON stream and asserts that it is the
beginning of a new object.
|
void |
close()
Closes this JSON reader and the underlying
Reader. |
void |
endArray()
Consumes the next token from the JSON stream and asserts that it is the
end of the current array.
|
void |
endObject()
Consumes the next token from the JSON stream and asserts that it is the
end of the current object.
|
private void |
expect(JsonToken expected) |
java.lang.String |
getPath()
Returns a JsonPath to
the current location in the JSON value.
|
boolean |
hasNext()
Returns true if the current array or object has another element.
|
private java.lang.String |
locationString() |
boolean |
nextBoolean()
Returns the
boolean value of the next token,
consuming it. |
double |
nextDouble()
Returns the
double value of the next token,
consuming it. |
int |
nextInt()
Returns the
int value of the next token,
consuming it. |
long |
nextLong()
Returns the
long value of the next token,
consuming it. |
java.lang.String |
nextName()
Returns the next token, a
property name, and
consumes it. |
void |
nextNull()
Consumes the next token from the JSON stream and asserts that it is a
literal null.
|
java.lang.String |
nextString()
Returns the
string value of the next token,
consuming it. |
JsonToken |
peek()
Returns the type of the next token without consuming it.
|
private java.lang.Object |
peekStack() |
private java.lang.Object |
popStack() |
void |
promoteNameToValue() |
private void |
push(java.lang.Object newTop) |
void |
skipValue()
Skips the next value recursively.
|
java.lang.String |
toString() |
isLenient, setLenientprivate static final java.io.Reader UNREADABLE_READER
private static final java.lang.Object SENTINEL_CLOSED
private java.lang.Object[] stack
private int stackSize
private java.lang.String[] pathNames
private int[] pathIndices
public JsonTreeReader(JsonElement element)
public void beginArray()
throws java.io.IOException
JsonReaderbeginArray in class JsonReaderjava.io.IOExceptionpublic void endArray()
throws java.io.IOException
JsonReaderendArray in class JsonReaderjava.io.IOExceptionpublic void beginObject()
throws java.io.IOException
JsonReaderbeginObject in class JsonReaderjava.io.IOExceptionpublic void endObject()
throws java.io.IOException
JsonReaderendObject in class JsonReaderjava.io.IOExceptionpublic boolean hasNext()
throws java.io.IOException
JsonReaderhasNext in class JsonReaderjava.io.IOExceptionpublic JsonToken peek() throws java.io.IOException
JsonReaderpeek in class JsonReaderjava.io.IOExceptionprivate java.lang.Object peekStack()
private java.lang.Object popStack()
private void expect(JsonToken expected) throws java.io.IOException
java.io.IOExceptionpublic java.lang.String nextName()
throws java.io.IOException
JsonReaderproperty name, and
consumes it.nextName in class JsonReaderjava.io.IOException - if the next token in the stream is not a property
name.public java.lang.String nextString()
throws java.io.IOException
JsonReaderstring value of the next token,
consuming it. If the next token is a number, this method will return its
string form.nextString in class JsonReaderjava.io.IOExceptionpublic boolean nextBoolean()
throws java.io.IOException
JsonReaderboolean value of the next token,
consuming it.nextBoolean in class JsonReaderjava.io.IOExceptionpublic void nextNull()
throws java.io.IOException
JsonReadernextNull in class JsonReaderjava.io.IOExceptionpublic double nextDouble()
throws java.io.IOException
JsonReaderdouble value of the next token,
consuming it. If the next token is a string, this method will attempt to
parse it as a double using Double.parseDouble(String).nextDouble in class JsonReaderjava.io.IOExceptionpublic long nextLong()
throws java.io.IOException
JsonReaderlong value of the next token,
consuming it. If the next token is a string, this method will attempt to
parse it as a long. If the next token's numeric value cannot be exactly
represented by a Java long, this method throws.nextLong in class JsonReaderjava.io.IOExceptionpublic int nextInt()
throws java.io.IOException
JsonReaderint value of the next token,
consuming it. If the next token is a string, this method will attempt to
parse it as an int. If the next token's numeric value cannot be exactly
represented by a Java int, this method throws.nextInt in class JsonReaderjava.io.IOExceptionpublic void close()
throws java.io.IOException
JsonReaderReader.close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class JsonReaderjava.io.IOExceptionpublic void skipValue()
throws java.io.IOException
JsonReaderskipValue in class JsonReaderjava.io.IOExceptionpublic java.lang.String toString()
toString in class JsonReaderpublic void promoteNameToValue()
throws java.io.IOException
java.io.IOExceptionprivate void push(java.lang.Object newTop)
public java.lang.String getPath()
JsonReadergetPath in class JsonReaderprivate java.lang.String locationString()