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()
CookJsonParser
getEvent
in interface CookJsonParser
public JsonValue getValue()
CookJsonParser
In 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 CookJsonParser
public JsonParser.Event next()
next
in interface JsonParser
public boolean hasNext()
hasNext
in interface JsonParser
public boolean isIntegralNumber()
isIntegralNumber
in interface JsonParser
public int getInt()
getInt
in interface JsonParser
public long getLong()
getLong
in interface JsonParser
public BigDecimal getBigDecimal()
getBigDecimal
in interface JsonParser
public JsonLocation getLocation()
getLocation
in interface JsonParser
public String getString()
getString
in interface JsonParser
public boolean isBinary()
CookJsonParser
isBinary
in interface CookJsonParser
public byte[] getBytes()
CookJsonParser
byte[]
value if the parser state is
JsonParser.Event.VALUE_STRING
and the data is actually a binary data.getBytes
in interface CookJsonParser
public void close()
close
in interface Closeable
close
in interface AutoCloseable
close
in interface JsonParser
public 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.