public class TextJsonParser extends Object implements CookJsonParser
JsonParser.Event| Constructor and Description |
|---|
TextJsonParser(Reader r)
Create a JsonParser based on a Reader input.
|
TextJsonParser(Reader r,
int bufferSize)
Create a JsonParser based on a Reader input and specifying the buffer size.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
BigDecimal |
getBigDecimal() |
byte[] |
getBytes()
Returns the
byte[] value if the parser state is
JsonParser.Event.VALUE_STRING and the data is actually a binary data. |
JsonParser.Event |
getEvent()
Gets the current event.
|
int |
getInt() |
JsonLocation |
getLocation() |
long |
getLong() |
String |
getString() |
JsonValue |
getValue()
Based on the current event, retrieve the JsonValue.
|
boolean |
hasNext() |
boolean |
isAllowComments()
Gets whether parsing comments is allowed.
|
boolean |
isBinary()
Returns true if the current JSON value at the current parser state is
actually a binary data.
|
boolean |
isIntegralNumber() |
JsonParser.Event |
next() |
void |
setAllowComments(boolean allowComments)
Sets to allow line and block comments to be embedded in JSON.
|
public TextJsonParser(Reader r)
r - reader inputpublic TextJsonParser(Reader r, int bufferSize)
r - reader inputbufferSize - the input buffer size.public JsonParser.Event getEvent()
CookJsonParsergetEvent in interface CookJsonParserpublic JsonValue getValue()
CookJsonParserIn case of START_OBJECT and START_ARRAY, JsonObject and JsonArray objects are returned. This feature is to allow the mixing of streaming and model based APIs.
getValue in interface CookJsonParserpublic JsonParser.Event next()
next in interface JsonParserpublic boolean hasNext()
hasNext in interface JsonParserpublic boolean isIntegralNumber()
isIntegralNumber in interface JsonParserpublic int getInt()
getInt in interface JsonParserpublic long getLong()
getLong in interface JsonParserpublic BigDecimal getBigDecimal()
getBigDecimal in interface JsonParserpublic JsonLocation getLocation()
getLocation in interface JsonParserpublic String getString()
getString in interface JsonParserpublic boolean isBinary()
CookJsonParserisBinary in interface CookJsonParserpublic byte[] getBytes()
CookJsonParserbyte[] value if the parser state is
JsonParser.Event.VALUE_STRING and the data is actually a binary data.getBytes in interface CookJsonParserpublic void close()
close in interface Closeableclose in interface AutoCloseableclose in interface JsonParserpublic boolean isAllowComments()
public void setAllowComments(boolean allowComments)
JSON standard does not allow JavaScript comments in JSON, so by default it is disabled.
Enabling this feature does not have any impact to parsing valid JSON files.
allowComments - the allowComments to setCopyright © 2016. All rights reserved.