public final class BufferedSourceJsonReader extends JsonReader
JsonReader.Token| Constructor and Description |
|---|
BufferedSourceJsonReader(okio.BufferedSource source) |
| 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() |
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.
|
boolean |
failOnUnknown()
Returns true if this parser forbids skipping values.
|
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 |
isLenient()
Returns true if this parser is liberal in what it accepts.
|
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.
|
<T> T |
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.
|
JsonReader.Token |
peek()
Returns the type of the next token without consuming it.
|
void |
setFailOnUnknown(boolean failOnUnknown)
Configure whether this parser throws a
JsonDataException when JsonReader.skipValue() is
called. |
void |
setLenient(boolean lenient)
Configure this parser to be liberal in what it accepts.
|
void |
skipValue()
Skips the next value recursively.
|
java.lang.String |
toString() |
public BufferedSourceJsonReader(okio.BufferedSource source)
public void setLenient(boolean lenient)
JsonReaderinfinities.
// or # and
ending with a newline character.
/* and ending with
*/. Such comments may not be nested.
'single quoted'.
'single quoted'.
; instead of ,.
= or => instead of
:.
; instead of ,.
setLenient in class JsonReaderpublic boolean isLenient()
JsonReaderisLenient in class JsonReaderpublic void setFailOnUnknown(boolean failOnUnknown)
JsonReaderJsonDataException when JsonReader.skipValue() is
called. By default this parser permits values to be skipped.
Forbid skipping to prevent unrecognized values from being silently ignored. This option is useful in development and debugging because it means a typo like "locatiom" will be detected early. It's potentially harmful in production because it complicates revising a JSON schema.
setFailOnUnknown in class JsonReaderpublic boolean failOnUnknown()
JsonReaderfailOnUnknown in class JsonReaderpublic 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 JsonReader.Token peek() throws java.io.IOException
JsonReaderpeek in class JsonReaderjava.io.IOExceptionpublic java.lang.String nextName()
throws java.io.IOException
JsonReadernextName in class JsonReaderjava.io.IOExceptionpublic java.lang.String nextString()
throws java.io.IOException
JsonReadernextString in class JsonReaderjava.io.IOExceptionpublic boolean nextBoolean()
throws java.io.IOException
JsonReadernextBoolean in class JsonReaderjava.io.IOExceptionpublic <T> T nextNull()
throws java.io.IOException
JsonReadernextNull in class JsonReaderjava.io.IOExceptionpublic double nextDouble()
throws java.io.IOException
JsonReaderDouble.parseDouble(String).nextDouble in class JsonReaderjava.io.IOExceptionpublic long nextLong()
throws java.io.IOException
JsonReaderlong, this method throws.nextLong in class JsonReaderjava.io.IOExceptionpublic int nextInt()
throws java.io.IOException
JsonReaderint, this method throws.nextInt in class JsonReaderjava.io.IOExceptionpublic void close()
throws java.io.IOException
java.io.IOExceptionpublic void skipValue()
throws java.io.IOException
JsonReaderThis throws a JsonDataException if this parser has been configured to fail on unknown values.
skipValue in class JsonReaderjava.io.IOExceptionpublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String getPath()
JsonReadergetPath in class JsonReader