JrsValue that implements JsonParser to allow
accessing contents of JSON tree in alternate form (stream of tokens).
Useful when a streaming source is expected by code, such as data binding
functionality.
| Modifier and Type | Field and Description |
|---|---|
| protected boolean | _closed
Flag that indicates whether parser is closed or not. |
| protected JsonToken | _nextToken
Sometimes parser needs to buffer a single look-ahead token; if so, it'll be stored here. |
| protected JrsValueCursor | _nodeCursor
Traversal context within tree |
| protected ObjectCodec | _objectCodec
Optional codec, to allow chaining. |
| protected boolean | _startContainer
Flag needed to handle recursion into contents of child Array/Object nodes. |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected void | _handleEOF()
Implements abstract com. Method sub-classes need to implement for verifying that end-of-content is acceptable at current input position. |
| public void | close()
Implements abstract com. Implements java. Closes the parser so that no further iteration or data access
can be made; will also close the underlying input source
if parser either owns the input source, or feature
|
| public JsonLocation | currentLocation()
Overrides com. Method that returns location of the last processed input unit (character or byte) from the input; usually for error reporting purposes. |
| public String | currentName()
Overrides com. Method that can be called to get the name associated with
the current token: for |
| protected JrsValue | |
| protected JrsNumber | |
| protected Number | |
| public JsonLocation | currentTokenLocation()
Overrides com. Method that return the starting location of the current (most recently returned) token; that is, the position of the first input unit (character or byte) from input that starts the current token. |
| public BigInteger | getBigIntegerValue()
Implements abstract com. Numeric accessor that can be called when the current
token is of type |
| public byte[] | getBinaryValue(Base64Variant
Expected variant of base64 encoded
content (see b64variant)Base64Variants for definitions
of "standard" variants).Implements abstract com. Method that can be used to read (and consume -- results may not be accessible using other methods after the call) base64-encoded binary data included in the current textual JSON value. |
| public ObjectCodec | getCodec()
Implements abstract com. Accessor for |
| public JsonLocation | getCurrentLocation()
Implements abstract com.
Deprecated
Deprecated alias for |
| public String | getCurrentName()
Implements abstract com.
Deprecated
Deprecated alias of |
| public BigDecimal | getDecimalValue()
Implements abstract com. Numeric accessor that can be called when the current
token is of type |
| public double | getDoubleValue()
Implements abstract com. Numeric accessor that can be called when the current
token is of type |
| public Object | getEmbeddedObject()
Overrides com. Accessor that can be called if (and only if) the current token
is |
| public float | getFloatValue()
Implements abstract com. Numeric accessor that can be called when the current
token is of type |
| public int | getIntValue()
Implements abstract com. Numeric accessor that can be called when the current
token is of type |
| public long | getLongValue()
Implements abstract com. Numeric accessor that can be called when the current
token is of type |
| public JsonParser. | getNumberType()
Implements abstract com. If current token is of type
|
| public Number | getNumberValue()
Implements abstract com. Generic number value accessor method that will work for all kinds of numeric values. |
| public JsonStreamContext | getParsingContext()
Implements abstract com. Method that can be used to access current parsing context reader is in. There are 3 different types: root, array and object contexts, with slightly different available information. |
| public String | getText()
Implements abstract com. Method for accessing textual representation of the current token;
if no current token (before first call to |
| public char[] | getTextCharacters()
Implements abstract com. Method similar to |
| public int | getTextLength()
Implements abstract com. Accessor used with |
| public int | getTextOffset()
Implements abstract com. Accessor used with |
| public JsonLocation | getTokenLocation()
Implements abstract com.
Deprecated
Deprecated alias for |
| public boolean | hasTextCharacters()
Implements abstract com. Method that can be used to determine whether calling of
|
| public boolean | isClosed()
Implements abstract com. Method that can be called to determine whether this parser is closed or not. |
| public JsonToken | nextToken()
Implements abstract com. Main iteration method, which will advance stream enough to determine type of the next token, if any. |
| public void | overrideCurrentName(String
Name to use as the current name; may be null. name)Implements abstract com. Method that can be used to change what is considered to be the current (field) name. |
| public int | readBinaryValue(Base64Variant
base64 variant to use b64variant, OutputStream Output stream to use for passing decoded binary data out)Overrides com. Similar to |
| public void | setCodec(ObjectCodec
Codec to assign, if any; c)null if noneImplements abstract com. Setter that allows defining |
| public JsonParser | skipChildren()
Overrides com. Method that will skip all child tokens of an array or
object token that the parser currently points to,
if (and only if) stream points to
|
| public Version | version()
Implements abstract com. Implements com. Accessor for getting version of the core package, given a parser instance. |
| _closed | back to summary |
|---|---|
| protected boolean _closed Flag that indicates whether parser is closed or not. Gets
set when parser is either closed by explicit call
( | |
| _nextToken | back to summary |
|---|---|
| protected JsonToken _nextToken Sometimes parser needs to buffer a single look-ahead token; if so, it'll be stored here. This is currently used for handling | |
| _nodeCursor | back to summary |
|---|---|
| protected JrsValueCursor _nodeCursor Traversal context within tree | |
| _objectCodec | back to summary |
|---|---|
| protected ObjectCodec _objectCodec Optional codec, to allow chaining. | |
| _startContainer | back to summary |
|---|---|
| protected boolean _startContainer Flag needed to handle recursion into contents of child Array/Object nodes. | |
| JrsTreeTraversingParser | back to summary |
|---|---|
| public JrsTreeTraversingParser(JrsValue n) | |
| JrsTreeTraversingParser | back to summary |
|---|---|
| public JrsTreeTraversingParser(JrsValue n, ObjectCodec codec) | |
| _handleEOF | back to summary |
|---|---|
| protected void _handleEOF() throws JsonParseException Implements abstract com. Doc from com. Method sub-classes need to implement for verifying that end-of-content is acceptable at current input position.
| |
| close | back to summary |
|---|---|
| public void close() throws IOException Implements abstract com. Implements java. Doc from com. Closes the parser so that no further iteration or data access
can be made; will also close the underlying input source
if parser either owns the input source, or feature
| |
| currentLocation | back to summary |
|---|---|
| public JsonLocation currentLocation() Overrides com. Doc from com. Method that returns location of the last processed input unit (character or byte) from the input; usually for error reporting purposes.
Note that the location is not guaranteed to be accurate (although most
implementation will try their best): some implementations may only
report specific boundary locations (start or end locations of tokens)
and others only return
| |
| currentName | back to summary |
|---|---|
| public String currentName() Overrides com. Doc from com. Method that can be called to get the name associated with
the current token: for | |
| currentNode | back to summary |
|---|---|
| protected JrsValue currentNode() | |
| currentNumericNode | back to summary |
|---|---|
| protected JrsNumber currentNumericNode() throws JsonParseException | |
| currentNumericValue | back to summary |
|---|---|
| protected Number currentNumericValue() throws JsonParseException | |
| currentTokenLocation | back to summary |
|---|---|
| public JsonLocation currentTokenLocation() Overrides com. Doc from com. Method that return the starting location of the current (most recently returned) token; that is, the position of the first input unit (character or byte) from input that starts the current token.
Note that the location is not guaranteed to be accurate (although most
implementation will try their best): some implementations may only
return
| |
| getBigIntegerValue | back to summary |
|---|---|
| public BigInteger getBigIntegerValue() throws IOException Implements abstract com. Doc from com. Numeric accessor that can be called when the current
token is of type
| |
| getBinaryValue | back to summary |
|---|---|
| public byte[] getBinaryValue(Base64Variant b64variant) throws IOException Implements abstract com. Doc from com. Method that can be used to read (and consume -- results
may not be accessible using other methods after the call)
base64-encoded binary data
included in the current textual JSON value.
It works similar to getting String value via Note that non-decoded textual contents of the current token are not guaranteed to be accessible after this method is called. Current implementation, for example, clears up textual content during decoding. Decoded binary content, however, will be retained until parser is advanced to the next event.
| |
| getCodec | back to summary |
|---|---|
| public ObjectCodec getCodec() Implements abstract com. Doc from com. Accessor for
| |
| getCurrentLocation | back to summary |
|---|---|
| public JsonLocation getCurrentLocation() Implements abstract com. Doc from com. Deprecated
Deprecated alias for
| |
| getCurrentName | back to summary |
|---|---|
| public String getCurrentName() Implements abstract com. Doc from com. Deprecated
Deprecated alias of
| |
| getDecimalValue | back to summary |
|---|---|
| public BigDecimal getDecimalValue() throws IOException Implements abstract com. Doc from com. Numeric accessor that can be called when the current
token is of type
| |
| getDoubleValue | back to summary |
|---|---|
| public double getDoubleValue() throws IOException Implements abstract com. Doc from com. Numeric accessor that can be called when the current
token is of type Note if the value falls
outside of range of Java double, a
| |
| getEmbeddedObject | back to summary |
|---|---|
| public Object getEmbeddedObject() Overrides com. Doc from com. Accessor that can be called if (and only if) the current token
is Note only some specialized parser implementations support
embedding of objects (usually ones that are facades on top
of non-streaming sources, such as object trees). One exception
is access to binary content (whether via base64 encoding or not)
which typically is accessible using this method, as well as
| |
| getFloatValue | back to summary |
|---|---|
| public float getFloatValue() throws IOException Implements abstract com. Doc from com. Numeric accessor that can be called when the current
token is of type Note if the value falls
outside of range of Java float, a
| |
| getIntValue | back to summary |
|---|---|
| public int getIntValue() throws IOException Implements abstract com. Doc from com. Numeric accessor that can be called when the current
token is of type Note if the resulting integer value falls outside range of
Java
| |
| getLongValue | back to summary |
|---|---|
| public long getLongValue() throws IOException Implements abstract com. Doc from com. Numeric accessor that can be called when the current
token is of type Note if the token is an integer, but its value falls
outside of range of Java long, a
| |
| getNumberType | back to summary |
|---|---|
| public JsonParser. Implements abstract com. Doc from com. If current token is of type
| |
| getNumberValue | back to summary |
|---|---|
| public Number getNumberValue() throws IOException Implements abstract com. Doc from com. Generic number value accessor method that will work for all kinds of numeric values. It will return the optimal (simplest/smallest possible) wrapper object that can express the numeric value just parsed.
| |
| getParsingContext | back to summary |
|---|---|
| public JsonStreamContext getParsingContext() Implements abstract com. Doc from com. Method that can be used to access current parsing context reader is in. There are 3 different types: root, array and object contexts, with slightly different available information. Contexts are hierarchically nested, and can be used for example for figuring out part of the input document that correspond to specific array or object (for highlighting purposes, or error reporting). Contexts can also be used for simple xpath-like matching of input, if so desired.
| |
| getText | back to summary |
|---|---|
| public String getText() Implements abstract com. Doc from com. Method for accessing textual representation of the current token;
if no current token (before first call to
| |
| getTextCharacters | back to summary |
|---|---|
| public char[] getTextCharacters() throws IOException Implements abstract com. Doc from com. Method similar to
Note that caller MUST NOT modify the returned character array in any way -- doing so may corrupt current parser state and render parser instance useless.
The only reason to call this method (over
| |
| getTextLength | back to summary |
|---|---|
| public int getTextLength() throws IOException Implements abstract com. Doc from com. Accessor used with
| |
| getTextOffset | back to summary |
|---|---|
| public int getTextOffset() throws IOException Implements abstract com. Doc from com. Accessor used with
| |
| getTokenLocation | back to summary |
|---|---|
| public JsonLocation getTokenLocation() Implements abstract com. Doc from com. Deprecated
Deprecated alias for
| |
| hasTextCharacters | back to summary |
|---|---|
| public boolean hasTextCharacters() Implements abstract com. Doc from com. Method that can be used to determine whether calling of
Default implementation simply returns false since only actual implementation class has knowledge of its internal buffering state. Implementations are strongly encouraged to properly override this method, to allow efficient copying of content by other code.
| |
| isClosed | back to summary |
|---|---|
| public boolean isClosed() Implements abstract com. Doc from com. Method that can be called to determine whether this parser
is closed or not. If it is closed, no new tokens can be
retrieved by calling
| |
| nextToken | back to summary |
|---|---|
| public JsonToken nextToken() throws IOException Implements abstract com. Doc from com. Main iteration method, which will advance stream enough to determine type of the next token, if any. If none remaining (stream has no content other than possible white space before ending), null will be returned.
| |
| overrideCurrentName | back to summary |
|---|---|
| public void overrideCurrentName(String name) Implements abstract com. Doc from com. Method that can be used to change what is considered to be the current (field) name. May be needed to support non-JSON data formats or unusual binding conventions; not needed for typical processing. Note that use of this method should only be done as sort of last resort, as it is a work-around for regular operation. | |
| readBinaryValue | back to summary |
|---|---|
| public int readBinaryValue(Base64Variant b64variant, OutputStream out) throws IOException Overrides com. Doc from com. Similar to
| |
| setCodec | back to summary |
|---|---|
| public void setCodec(ObjectCodec c) Implements abstract com. Doc from com. Setter that allows defining
| |
| skipChildren | back to summary |
|---|---|
| public JsonParser skipChildren() throws IOException Overrides com. Doc from com. Method that will skip all child tokens of an array or
object token that the parser currently points to,
if (and only if) stream points to
| |
| version | back to summary |
|---|---|
| public Version version() Implements abstract com. Implements com. Doc from com. Accessor for getting version of the core package, given a parser instance. Left for sub-classes to implement. | |