public final class JsonTreeReader extends JsonReader
| 构造器和说明 |
|---|
JsonTreeReader(JsonElement element) |
| 限定符和类型 | 方法和说明 |
|---|---|
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.
|
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. |
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.
|
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.
|
String |
toString() |
isLenient, setLenientpublic JsonTreeReader(JsonElement element)
public void beginArray()
throws IOException
JsonReaderbeginArray 在类中 JsonReaderIOExceptionpublic void endArray()
throws IOException
JsonReaderendArray 在类中 JsonReaderIOExceptionpublic void beginObject()
throws IOException
JsonReaderbeginObject 在类中 JsonReaderIOExceptionpublic void endObject()
throws IOException
JsonReaderendObject 在类中 JsonReaderIOExceptionpublic boolean hasNext()
throws IOException
JsonReaderhasNext 在类中 JsonReaderIOExceptionpublic JsonToken peek() throws IOException
JsonReaderpeek 在类中 JsonReaderIOExceptionpublic String nextName() throws IOException
JsonReaderproperty name, and
consumes it.nextName 在类中 JsonReaderIOException - if the next token in the stream is not a property
name.public String nextString() throws IOException
JsonReaderstring value of the next token,
consuming it. If the next token is a number, this method will return its
string form.nextString 在类中 JsonReaderIOExceptionpublic boolean nextBoolean()
throws IOException
JsonReaderboolean value of the next token,
consuming it.nextBoolean 在类中 JsonReaderIOExceptionpublic void nextNull()
throws IOException
JsonReadernextNull 在类中 JsonReaderIOExceptionpublic double nextDouble()
throws 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 在类中 JsonReaderIOExceptionpublic long nextLong()
throws 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 在类中 JsonReaderIOExceptionpublic int nextInt()
throws 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 在类中 JsonReaderIOExceptionpublic void close()
throws IOException
JsonReaderReader.close 在接口中 Closeableclose 在接口中 AutoCloseableclose 在类中 JsonReaderIOExceptionpublic void skipValue()
throws IOException
JsonReaderskipValue 在类中 JsonReaderIOExceptionpublic String toString()
toString 在类中 JsonReaderpublic void promoteNameToValue()
throws IOException
IOExceptionpublic String getPath()
JsonReadergetPath 在类中 JsonReader