public final class JsonTreeReader extends JsonReader
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.
|
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.
|
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.
|
void |
promoteNameToValue() |
void |
skipValue()
Skips the next value recursively.
|
java.lang.String |
toString() |
isLenient, setLenient
public JsonTreeReader(JsonElement element)
public void beginArray() throws java.io.IOException
JsonReader
beginArray
in class JsonReader
java.io.IOException
public void endArray() throws java.io.IOException
JsonReader
endArray
in class JsonReader
java.io.IOException
public void beginObject() throws java.io.IOException
JsonReader
beginObject
in class JsonReader
java.io.IOException
public void endObject() throws java.io.IOException
JsonReader
endObject
in class JsonReader
java.io.IOException
public boolean hasNext() throws java.io.IOException
JsonReader
hasNext
in class JsonReader
java.io.IOException
public JsonToken peek() throws java.io.IOException
JsonReader
peek
in class JsonReader
java.io.IOException
public java.lang.String nextName() throws java.io.IOException
JsonReader
property name
, and
consumes it.nextName
in class JsonReader
java.io.IOException
- if the next token in the stream is not a property
name.public java.lang.String nextString() throws java.io.IOException
JsonReader
string
value of the next token,
consuming it. If the next token is a number, this method will return its
string form.nextString
in class JsonReader
java.io.IOException
public boolean nextBoolean() throws java.io.IOException
JsonReader
boolean
value of the next token,
consuming it.nextBoolean
in class JsonReader
java.io.IOException
public void nextNull() throws java.io.IOException
JsonReader
nextNull
in class JsonReader
java.io.IOException
public double nextDouble() throws java.io.IOException
JsonReader
double
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 JsonReader
java.io.IOException
public long nextLong() throws java.io.IOException
JsonReader
long
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 JsonReader
java.io.IOException
public int nextInt() throws java.io.IOException
JsonReader
int
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 JsonReader
java.io.IOException
public void close() throws java.io.IOException
JsonReader
Reader
.close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class JsonReader
java.io.IOException
public void skipValue() throws java.io.IOException
JsonReader
skipValue
in class JsonReader
java.io.IOException
public java.lang.String toString()
toString
in class JsonReader
public void promoteNameToValue() throws java.io.IOException
java.io.IOException
public java.lang.String getPath()
JsonReader
getPath
in class JsonReader