Top Description Fields Constructors Methods
com.fasterxml.jackson.databind.node

public Class TreeTraversingParser

extends ParserMinimalBase
Class Inheritance
Imports
java.io.IOException, .OutputStream, java.math.BigDecimal, .BigInteger, com.fasterxml.jackson.core.*, com.fasterxml.jackson.core.base.ParserMinimalBase, com.fasterxml.jackson.core.util.JacksonFeatureSet, com.fasterxml.jackson.databind.JsonNode

Facade over JsonNode 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.

Field Summary

Modifier and TypeField and Description
protected boolean
_closed

Flag that indicates whether parser is closed or not.

protected NodeCursor
_nodeCursor

Traversal context within tree

protected ObjectCodec
Inherited from com.fasterxml.jackson.core.base.ParserMinimalBase:
_currToken_lastClearedTokenBD_MAX_INTBD_MAX_LONGBD_MIN_INTBD_MIN_LONGBI_MAX_INTBI_MAX_LONGBI_MIN_INTBI_MIN_LONGCHAR_NULLINT_0INT_9INT_APOSINT_ASTERISKINT_BACKSLASHINT_COLONINT_COMMAINT_CRINT_eINT_EINT_HASHINT_LBRACKETINT_LCURLYINT_LFINT_MINUSINT_PERIODINT_PLUSINT_QUOTEINT_RBRACKETINT_RCURLYINT_SLASHINT_SPACEINT_TABMAX_ERROR_TOKEN_LENGTHMAX_INT_DMAX_INT_LMAX_LONG_DMIN_INT_DMIN_INT_LMIN_LONG_DNO_BYTESNO_INTSNR_BIGDECIMALNR_BIGINTNR_DOUBLENR_FLOATNR_INTNR_LONGNR_UNKNOWN

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
protected void
_handleEOF()

Implements abstract com.fasterxml.jackson.core.base.ParserMinimalBase._handleEOF.

Method sub-classes need to implement for verifying that end-of-content is acceptable at current input position.

public void
close()

Implements abstract com.fasterxml.jackson.core.base.ParserMinimalBase.close.

Implements java.io.Closeable.close.

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 Feature#AUTO_CLOSE_SOURCE is enabled.

public JsonLocation
currentLocation()

Overrides com.fasterxml.jackson.core.JsonParser.currentLocation.

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.fasterxml.jackson.core.JsonParser.currentName.

Method that can be called to get the name associated with the current token: for JsonToken#FIELD_NAMEs it will be the same as what getText returns; for field values it will be preceding field name; and for others (array values, root-level values) null.

protected JsonNode
protected JsonNode
public JsonLocation
currentTokenLocation()

Overrides com.fasterxml.jackson.core.JsonParser.currentTokenLocation.

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.fasterxml.jackson.core.JsonParser.getBigIntegerValue.

Numeric accessor that can be called when the current token is of type JsonToken#VALUE_NUMBER_INT and it can not be used as a Java long primitive type due to its magnitude.

public byte[]
getBinaryValue(Base64Variant
Expected variant of base64 encoded content (see Base64Variants for definitions of "standard" variants).
b64variant
)

Implements abstract com.fasterxml.jackson.core.base.ParserMinimalBase.getBinaryValue.

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.fasterxml.jackson.core.JsonParser.getCodec.

Accessor for ObjectCodec associated with this parser, if any.

public JsonLocation
getCurrentLocation()

Implements abstract com.fasterxml.jackson.core.JsonParser.getCurrentLocation.

Deprecated

Deprecated alias for currentLocation() (removed from Jackson 3.0).

public String
public BigDecimal
getDecimalValue()

Implements abstract com.fasterxml.jackson.core.JsonParser.getDecimalValue.

Numeric accessor that can be called when the current token is of type JsonToken#VALUE_NUMBER_FLOAT or JsonToken#VALUE_NUMBER_INT.

public double
getDoubleValue()

Implements abstract com.fasterxml.jackson.core.JsonParser.getDoubleValue.

Numeric accessor that can be called when the current token is of type JsonToken#VALUE_NUMBER_FLOAT and it can be expressed as a Java double primitive type.

public Object
getEmbeddedObject()

Overrides com.fasterxml.jackson.core.JsonParser.getEmbeddedObject.

Accessor that can be called if (and only if) the current token is JsonToken#VALUE_EMBEDDED_OBJECT.

public float
getFloatValue()

Implements abstract com.fasterxml.jackson.core.JsonParser.getFloatValue.

Numeric accessor that can be called when the current token is of type JsonToken#VALUE_NUMBER_FLOAT and it can be expressed as a Java float primitive type.

public int
getIntValue()

Implements abstract com.fasterxml.jackson.core.JsonParser.getIntValue.

Numeric accessor that can be called when the current token is of type JsonToken#VALUE_NUMBER_INT and it can be expressed as a value of Java int primitive type.

public long
getLongValue()

Implements abstract com.fasterxml.jackson.core.JsonParser.getLongValue.

Numeric accessor that can be called when the current token is of type JsonToken#VALUE_NUMBER_INT and it can be expressed as a Java long primitive type.

public JsonParser.NumberType
getNumberType()

Implements abstract com.fasterxml.jackson.core.JsonParser.getNumberType.

If current token is of type JsonToken#VALUE_NUMBER_INT or JsonToken#VALUE_NUMBER_FLOAT, returns one of NumberType constants; otherwise returns null.

public JsonParser.NumberTypeFP
getNumberTypeFP()

Overrides com.fasterxml.jackson.core.JsonParser.getNumberTypeFP.

If current token is of type JsonToken#VALUE_NUMBER_FLOAT, returns one of NumberTypeFP constants; otherwise returns NumberTypeFP#UNKNOWN.

public Number
getNumberValue()

Implements abstract com.fasterxml.jackson.core.JsonParser.getNumberValue.

Generic number value accessor method that will work for all kinds of numeric values.

public JsonStreamContext
getParsingContext()

Implements abstract com.fasterxml.jackson.core.base.ParserMinimalBase.getParsingContext.

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 JacksonFeatureSet<StreamReadCapability>
getReadCapabilities()

Overrides com.fasterxml.jackson.core.JsonParser.getReadCapabilities.

Accessor for getting metadata on capabilities of this parser, based on underlying data format being read (directly or indirectly).

public String
getText()

Implements abstract com.fasterxml.jackson.core.base.ParserMinimalBase.getText.

Method for accessing textual representation of the current token; if no current token (before first call to nextToken, or after encountering end-of-input), returns null.

public char[]
getTextCharacters()

Implements abstract com.fasterxml.jackson.core.base.ParserMinimalBase.getTextCharacters.

Method similar to getText, but that will return underlying (unmodifiable) character array that contains textual value, instead of constructing a String object to contain this information.

public int
getTextLength()

Implements abstract com.fasterxml.jackson.core.base.ParserMinimalBase.getTextLength.

Accessor used with getTextCharacters, to know length of String stored in returned buffer.

public int
getTextOffset()

Implements abstract com.fasterxml.jackson.core.base.ParserMinimalBase.getTextOffset.

Accessor used with getTextCharacters, to know offset of the first text content character within buffer.

public JsonLocation
getTokenLocation()

Implements abstract com.fasterxml.jackson.core.JsonParser.getTokenLocation.

Deprecated

Deprecated alias for currentTokenLocation() (removed from Jackson 3.0).

public boolean
hasTextCharacters()

Implements abstract com.fasterxml.jackson.core.base.ParserMinimalBase.hasTextCharacters.

Method that can be used to determine whether calling of getTextCharacters would be the most efficient way to access textual content for the event parser currently points to.

public boolean
isClosed()

Implements abstract com.fasterxml.jackson.core.base.ParserMinimalBase.isClosed.

Method that can be called to determine whether this parser is closed or not.

public boolean
isNaN()

Overrides com.fasterxml.jackson.core.JsonParser.isNaN.

Accessor for checking whether current token is a special "not-a-number" (NaN) token (including both "NaN" AND positive/negative infinity!).

public JsonToken
nextToken()

Implements abstract com.fasterxml.jackson.core.base.ParserMinimalBase.nextToken.

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.fasterxml.jackson.core.base.ParserMinimalBase.overrideCurrentName.

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.fasterxml.jackson.core.JsonParser.readBinaryValue.

Similar to readBinaryValue(OutputStream) but allows explicitly specifying base64 variant to use.

public void
setCodec(ObjectCodec
Codec to assign, if any; null if none
c
)

Implements abstract com.fasterxml.jackson.core.JsonParser.setCodec.

Setter that allows defining ObjectCodec associated with this parser, if any.

public JsonParser
skipChildren()

Overrides com.fasterxml.jackson.core.base.ParserMinimalBase.skipChildren.

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 JsonToken#START_OBJECT or JsonToken#START_ARRAY.

public Version
version()

Implements abstract com.fasterxml.jackson.core.JsonParser.version.

Implements com.fasterxml.jackson.core.Versioned.version.

Accessor for getting version of the core package, given a parser instance.

Inherited from com.fasterxml.jackson.core.base.ParserMinimalBase:
_ascii_asciiBytes_constructError_decodeBase64_getCharDesc_hasTextualNull_longIntegerDesc_longNumberDesc_reportError_reportError_reportError_reportInputCoercion_reportInvalidEOF_reportInvalidEOF_reportInvalidEOF_reportInvalidEOFInValue_reportInvalidEOFInValue_reportMissingRootWS_reportUnexpectedChar_reportUnexpectedNumberChar_throwInternal_throwInvalidSpace_wrapErrorclearCurrentTokencurrentTokencurrentTokenIdgetCurrentTokengetCurrentTokenIdgetLastClearedTokengetValueAsBooleangetValueAsDoublegetValueAsIntgetValueAsIntgetValueAsLonggetValueAsLonggetValueAsStringgetValueAsStringhasCurrentTokenhasTokenhasTokenIdisExpectedNumberIntTokenisExpectedStartArrayTokenisExpectedStartObjectTokennextValuereportInvalidNumberreportOverflowIntreportOverflowIntreportOverflowIntreportOverflowLongreportOverflowLongreportOverflowLongreportUnexpectedNumberChar

Field Detail

_closedback to summary
protected boolean _closed

Flag that indicates whether parser is closed or not. Gets set when parser is either closed by explicit call (close) or when end-of-input is reached.

_nodeCursorback to summary
protected NodeCursor _nodeCursor

Traversal context within tree

_objectCodecback to summary
protected ObjectCodec _objectCodec

Constructor Detail

TreeTraversingParserback to summary
public TreeTraversingParser(JsonNode n)
TreeTraversingParserback to summary
public TreeTraversingParser(JsonNode n, ObjectCodec codec)

Method Detail

_handleEOFback to summary
protected void _handleEOF()

Implements abstract com.fasterxml.jackson.core.base.ParserMinimalBase._handleEOF.

Doc from com.fasterxml.jackson.core.base.ParserMinimalBase._handleEOF.

Method sub-classes need to implement for verifying that end-of-content is acceptable at current input position.

Annotations
@Override
closeback to summary
public void close() throws IOException

Implements abstract com.fasterxml.jackson.core.base.ParserMinimalBase.close.

Implements java.io.Closeable.close.

Doc from com.fasterxml.jackson.core.JsonParser.close.

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 Feature#AUTO_CLOSE_SOURCE is enabled. Whether parser owns the input source depends on factory method that was used to construct instance (so check com.fasterxml.jackson.core.JsonFactory for details, but the general idea is that if caller passes in closable resource (such as InputStream or Reader) parser does NOT own the source; but if it passes a reference (such as java.io.File or java.net.URL and creates stream or reader it does own them.

Annotations
@Override
Exceptions
IOException:
if there is either an underlying I/O problem
currentLocationback to summary
public JsonLocation currentLocation()

Overrides com.fasterxml.jackson.core.JsonParser.currentLocation.

Doc from com.fasterxml.jackson.core.JsonParser.currentLocation.

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 JsonLocation#NA due to not having access to input location information (when delegating actual decoding work to other library)

Returns:JsonLocation

Location of the last processed input unit (byte or character)

Annotations
@Override
currentNameback to summary
public String currentName()

Overrides com.fasterxml.jackson.core.JsonParser.currentName.

Doc from com.fasterxml.jackson.core.JsonParser.currentName.

Method that can be called to get the name associated with the current token: for JsonToken#FIELD_NAMEs it will be the same as what getText returns; for field values it will be preceding field name; and for others (array values, root-level values) null.

Returns:String

Name of the current field in the parsing context

Annotations
@Override
currentNodeback to summary
protected JsonNode currentNode()
currentNumericNodeback to summary
protected JsonNode currentNumericNode() throws JacksonException
currentTokenLocationback to summary
public JsonLocation currentTokenLocation()

Overrides com.fasterxml.jackson.core.JsonParser.currentTokenLocation.

Doc from com.fasterxml.jackson.core.JsonParser.currentTokenLocation.

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 JsonLocation#NA due to not having access to input location information (when delegating actual decoding work to other library)

Returns:JsonLocation

Starting location of the token parser currently points to

Annotations
@Override
getBigIntegerValueback to summary
public BigInteger getBigIntegerValue() throws IOException

Implements abstract com.fasterxml.jackson.core.JsonParser.getBigIntegerValue.

Doc from com.fasterxml.jackson.core.JsonParser.getBigIntegerValue.

Numeric accessor that can be called when the current token is of type JsonToken#VALUE_NUMBER_INT and it can not be used as a Java long primitive type due to its magnitude. It can also be called for JsonToken#VALUE_NUMBER_FLOAT; if so, it is equivalent to calling getDecimalValue and then constructing a BigInteger from that value.

Returns:BigInteger

Current number value as BigInteger (if numeric token); otherwise exception thrown

Annotations
@Override
Exceptions
IOException:
for low-level read issues, or JsonParseException for decoding problems
getBinaryValueback to summary
public byte[] getBinaryValue(Base64Variant b64variant) throws IOException

Implements abstract com.fasterxml.jackson.core.base.ParserMinimalBase.getBinaryValue.

Doc from com.fasterxml.jackson.core.JsonParser.getBinaryValue.

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 getText and decoding result (except for decoding part), but should be significantly more performant.

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.

Parameters
b64variant:Base64Variant

Expected variant of base64 encoded content (see Base64Variants for definitions of "standard" variants).

Returns:byte[]

Decoded binary data

Annotations
@Override
Exceptions
IOException:
for low-level read issues, or JsonParseException for decoding problems
getCodecback to summary
public ObjectCodec getCodec()

Implements abstract com.fasterxml.jackson.core.JsonParser.getCodec.

Doc from com.fasterxml.jackson.core.JsonParser.getCodec.

Accessor for ObjectCodec associated with this parser, if any. Codec is used by readValueAs(Class) method (and its variants).

Returns:ObjectCodec

Codec assigned to this parser, if any; null if none

Annotations
@Override
getCurrentLocationback to summary
public JsonLocation getCurrentLocation()

Implements abstract com.fasterxml.jackson.core.JsonParser.getCurrentLocation.

Doc from com.fasterxml.jackson.core.JsonParser.getCurrentLocation.

Deprecated

Deprecated alias for currentLocation() (removed from Jackson 3.0).

Returns:JsonLocation

Location of the last processed input unit (byte or character)

Annotations
@Deprecated
@Override
getCurrentNameback to summary
public String getCurrentName()

Implements abstract com.fasterxml.jackson.core.base.ParserMinimalBase.getCurrentName.

Doc from com.fasterxml.jackson.core.JsonParser.getCurrentName.

Deprecated

Deprecated alias of currentName().

Returns:String

Name of the current field in the parsing context

Annotations
@Deprecated
@Override
getDecimalValueback to summary
public BigDecimal getDecimalValue() throws IOException

Implements abstract com.fasterxml.jackson.core.JsonParser.getDecimalValue.

Doc from com.fasterxml.jackson.core.JsonParser.getDecimalValue.

Numeric accessor that can be called when the current token is of type JsonToken#VALUE_NUMBER_FLOAT or JsonToken#VALUE_NUMBER_INT. No under/overflow exceptions are ever thrown.

Returns:BigDecimal

Current number value as BigDecimal (if numeric token); otherwise exception thrown

Annotations
@Override
Exceptions
IOException:
for low-level read issues, or JsonParseException for decoding problems
getDoubleValueback to summary
public double getDoubleValue() throws IOException

Implements abstract com.fasterxml.jackson.core.JsonParser.getDoubleValue.

Doc from com.fasterxml.jackson.core.JsonParser.getDoubleValue.

Numeric accessor that can be called when the current token is of type JsonToken#VALUE_NUMBER_FLOAT and it can be expressed as a Java double primitive type. It can also be called for JsonToken#VALUE_NUMBER_INT; if so, it is equivalent to calling getLongValue and then casting; except for possible overflow/underflow exception.

Note

if the value falls outside of range of Java double, a InputCoercionException will be thrown to indicate numeric overflow/underflow.

Returns:double

Current number value as double (if numeric token within Java double range); otherwise exception thrown

Annotations
@Override
Exceptions
IOException:
for low-level read issues, or JsonParseException for decoding problems
getEmbeddedObjectback to summary
public Object getEmbeddedObject()

Overrides com.fasterxml.jackson.core.JsonParser.getEmbeddedObject.

Doc from com.fasterxml.jackson.core.JsonParser.getEmbeddedObject.

Accessor that can be called if (and only if) the current token is JsonToken#VALUE_EMBEDDED_OBJECT. For other token types, null is returned.

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 getBinaryValue().

Returns:Object

Embedded value (usually of "native" type supported by format) for the current token, if any; null otherwise

Annotations
@Override
getFloatValueback to summary
public float getFloatValue() throws IOException

Implements abstract com.fasterxml.jackson.core.JsonParser.getFloatValue.

Doc from com.fasterxml.jackson.core.JsonParser.getFloatValue.

Numeric accessor that can be called when the current token is of type JsonToken#VALUE_NUMBER_FLOAT and it can be expressed as a Java float primitive type. It can also be called for JsonToken#VALUE_NUMBER_INT; if so, it is equivalent to calling getLongValue and then casting; except for possible overflow/underflow exception.

Note

if the value falls outside of range of Java float, a InputCoercionException will be thrown to indicate numeric overflow/underflow.

Returns:float

Current number value as float (if numeric token within Java float range); otherwise exception thrown

Annotations
@Override
Exceptions
IOException:
for low-level read issues, or JsonParseException for decoding problems
getIntValueback to summary
public int getIntValue() throws IOException

Implements abstract com.fasterxml.jackson.core.JsonParser.getIntValue.

Doc from com.fasterxml.jackson.core.JsonParser.getIntValue.

Numeric accessor that can be called when the current token is of type JsonToken#VALUE_NUMBER_INT and it can be expressed as a value of Java int primitive type. It can also be called for JsonToken#VALUE_NUMBER_FLOAT; if so, it is equivalent to calling getDoubleValue and then casting; except for possible overflow/underflow exception.

Note

if the resulting integer value falls outside range of Java int, a InputCoercionException may be thrown to indicate numeric overflow/underflow.

Returns:int

Current number value as int (if numeric token within Java 32-bit signed int range); otherwise exception thrown

Annotations
@Override
Exceptions
IOException:
for low-level read issues, or JsonParseException for decoding problems
getLongValueback to summary
public long getLongValue() throws IOException

Implements abstract com.fasterxml.jackson.core.JsonParser.getLongValue.

Doc from com.fasterxml.jackson.core.JsonParser.getLongValue.

Numeric accessor that can be called when the current token is of type JsonToken#VALUE_NUMBER_INT and it can be expressed as a Java long primitive type. It can also be called for JsonToken#VALUE_NUMBER_FLOAT; if so, it is equivalent to calling getDoubleValue and then casting to int; except for possible overflow/underflow exception.

Note

if the token is an integer, but its value falls outside of range of Java long, a InputCoercionException may be thrown to indicate numeric overflow/underflow.

Returns:long

Current number value as long (if numeric token within Java 32-bit signed long range); otherwise exception thrown

Annotations
@Override
Exceptions
IOException:
for low-level read issues, or JsonParseException for decoding problems
getNumberTypeback to summary
public JsonParser.NumberType getNumberType() throws IOException

Implements abstract com.fasterxml.jackson.core.JsonParser.getNumberType.

Doc from com.fasterxml.jackson.core.JsonParser.getNumberType.

If current token is of type JsonToken#VALUE_NUMBER_INT or JsonToken#VALUE_NUMBER_FLOAT, returns one of NumberType constants; otherwise returns null.

Returns:JsonParser.NumberType

Type of current number, if parser points to numeric token; null otherwise

Annotations
@Override
Exceptions
IOException:
for low-level read issues, or JsonParseException for decoding problems
getNumberTypeFPback to summary
public JsonParser.NumberTypeFP getNumberTypeFP() throws IOException

Overrides com.fasterxml.jackson.core.JsonParser.getNumberTypeFP.

Doc from com.fasterxml.jackson.core.JsonParser.getNumberTypeFP.

If current token is of type JsonToken#VALUE_NUMBER_FLOAT, returns one of NumberTypeFP constants; otherwise returns NumberTypeFP#UNKNOWN.

Default implementation as of Jackson 2.x will call getNumberType() and translate types -- this needs to be overriden actual implementations if this is not sufficient (which it usually is not for textual formats).

Returns:JsonParser.NumberTypeFP

Type of current floating-point number, if parser points to numeric token; NumberTypeFP#UNKNOWN otherwise.

Annotations
@Override
Exceptions
IOException:
for low-level read issues, or JsonParseException for decoding problems
getNumberValueback to summary
public Number getNumberValue() throws IOException

Implements abstract com.fasterxml.jackson.core.JsonParser.getNumberValue.

Doc from com.fasterxml.jackson.core.JsonParser.getNumberValue.

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.

Returns:Number

Numeric value of the current token in its most optimal representation

Annotations
@Override
Exceptions
IOException:
Problem with access: JsonParseException if the current token is not numeric, or if decoding of the value fails (invalid format for numbers); plain IOException if underlying content read fails (possible if values are extracted lazily)
getParsingContextback to summary
public JsonStreamContext getParsingContext()

Implements abstract com.fasterxml.jackson.core.base.ParserMinimalBase.getParsingContext.

Doc from com.fasterxml.jackson.core.JsonParser.getParsingContext.

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.

Returns:JsonStreamContext

Stream input context (JsonStreamContext) associated with this parser

Annotations
@Override
getReadCapabilitiesback to summary
public JacksonFeatureSet<StreamReadCapability> getReadCapabilities()

Overrides com.fasterxml.jackson.core.JsonParser.getReadCapabilities.

Doc from com.fasterxml.jackson.core.JsonParser.getReadCapabilities.

Accessor for getting metadata on capabilities of this parser, based on underlying data format being read (directly or indirectly).

Returns:JacksonFeatureSet<StreamReadCapability>

Set of read capabilities for content to read via this parser

Annotations
@Override
getTextback to summary
public String getText()

Implements abstract com.fasterxml.jackson.core.base.ParserMinimalBase.getText.

Doc from com.fasterxml.jackson.core.JsonParser.getText.

Method for accessing textual representation of the current token; if no current token (before first call to nextToken, or after encountering end-of-input), returns null. Method can be called for any token type.

Returns:String

Textual value associated with the current token (one returned by nextToken() or other iteration methods)

Annotations
@Override
getTextCharactersback to summary
public char[] getTextCharacters() throws IOException

Implements abstract com.fasterxml.jackson.core.base.ParserMinimalBase.getTextCharacters.

Doc from com.fasterxml.jackson.core.JsonParser.getTextCharacters.

Method similar to getText, but that will return underlying (unmodifiable) character array that contains textual value, instead of constructing a String object to contain this information. Note, however, that:

  • Textual contents are not guaranteed to start at index 0 (rather, call getTextOffset) to know the actual offset
  • Length of textual contents may be less than the length of returned buffer: call getTextLength for actual length of returned content.

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 getText) is to avoid construction of a String object (which will make a copy of contents).

Returns:char[]

Buffer that contains the current textual value (but not necessarily at offset 0, and not necessarily until the end of buffer)

Annotations
@Override
Exceptions
IOException:
for low-level read issues, or JsonParseException for decoding problems, including if the text is too large, see com.fasterxml.jackson.core.StreamReadConstraints.Builder#maxStringLength(int)
getTextLengthback to summary
public int getTextLength() throws IOException

Implements abstract com.fasterxml.jackson.core.base.ParserMinimalBase.getTextLength.

Doc from com.fasterxml.jackson.core.JsonParser.getTextLength.

Accessor used with getTextCharacters, to know length of String stored in returned buffer.

Returns:int

Number of characters within buffer returned by getTextCharacters that are part of textual content of the current token.

Annotations
@Override
Exceptions
IOException:
for low-level read issues, or JsonParseException for decoding problems
getTextOffsetback to summary
public int getTextOffset() throws IOException

Implements abstract com.fasterxml.jackson.core.base.ParserMinimalBase.getTextOffset.

Doc from com.fasterxml.jackson.core.JsonParser.getTextOffset.

Accessor used with getTextCharacters, to know offset of the first text content character within buffer.

Returns:int

Offset of the first character within buffer returned by getTextCharacters that is part of textual content of the current token.

Annotations
@Override
Exceptions
IOException:
for low-level read issues, or JsonParseException for decoding problems
getTokenLocationback to summary
public JsonLocation getTokenLocation()

Implements abstract com.fasterxml.jackson.core.JsonParser.getTokenLocation.

Doc from com.fasterxml.jackson.core.JsonParser.getTokenLocation.

Deprecated

Deprecated alias for currentTokenLocation() (removed from Jackson 3.0).

Returns:JsonLocation

Starting location of the token parser currently points to

Annotations
@Deprecated
@Override
hasTextCharactersback to summary
public boolean hasTextCharacters()

Implements abstract com.fasterxml.jackson.core.base.ParserMinimalBase.hasTextCharacters.

Doc from com.fasterxml.jackson.core.JsonParser.hasTextCharacters.

Method that can be used to determine whether calling of getTextCharacters would be the most efficient way to access textual content for the event parser currently points to.

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.

Returns:boolean

True if parser currently has character array that can be efficiently returned via getTextCharacters; false means that it may or may not exist

Annotations
@Override
isClosedback to summary
public boolean isClosed()

Implements abstract com.fasterxml.jackson.core.base.ParserMinimalBase.isClosed.

Doc from com.fasterxml.jackson.core.JsonParser.isClosed.

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 (and the underlying stream may be closed). Closing may be due to an explicit call to close or because parser has encountered end of input.

Returns:boolean

True if this parser instance has been closed

Annotations
@Override
isNaNback to summary
public boolean isNaN()

Overrides com.fasterxml.jackson.core.JsonParser.isNaN.

Doc from com.fasterxml.jackson.core.JsonParser.isNaN.

Accessor for checking whether current token is a special "not-a-number" (NaN) token (including both "NaN" AND positive/negative infinity!). These values are not supported by all formats: JSON, for example, only supports them if JsonReadFeature#ALLOW_NON_NUMERIC_NUMBERS is enabled.

Note

in case where numeric value is outside range of requested type -- most notably java.lang.Float or java.lang.Double -- and decoding results effectively in a NaN value, this method DOES NOT return true: only explicit incoming markers do. This is because value could still be accessed as a valid BigDecimal.

Returns:boolean

True if the current token is reported as JsonToken#VALUE_NUMBER_FLOAT and represents a "Not a Number" value; false for other tokens and regular floating-point numbers.

Annotations
@Override
nextTokenback to summary
public JsonToken nextToken() throws IOException

Implements abstract com.fasterxml.jackson.core.base.ParserMinimalBase.nextToken.

Doc from com.fasterxml.jackson.core.JsonParser.nextToken.

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.

Returns:JsonToken

Next token from the stream, if any found, or null to indicate end-of-input

Annotations
@Override
Exceptions
IOException:
for low-level read issues, or JsonParseException for decoding problems
overrideCurrentNameback to summary
public void overrideCurrentName(String name)

Implements abstract com.fasterxml.jackson.core.base.ParserMinimalBase.overrideCurrentName.

Doc from com.fasterxml.jackson.core.JsonParser.overrideCurrentName.

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.

Parameters
name:String

Name to use as the current name; may be null.

Annotations
@Override
readBinaryValueback to summary
public int readBinaryValue(Base64Variant b64variant, OutputStream out) throws IOException

Overrides com.fasterxml.jackson.core.JsonParser.readBinaryValue.

Doc from com.fasterxml.jackson.core.JsonParser.readBinaryValue.

Similar to readBinaryValue(OutputStream) but allows explicitly specifying base64 variant to use.

Parameters
b64variant:Base64Variant

base64 variant to use

out:OutputStream

Output stream to use for passing decoded binary data

Returns:int

Number of bytes that were decoded and written via OutputStream

Annotations
@Override
Exceptions
IOException:
for low-level read issues, or JsonParseException for decoding problems
setCodecback to summary
public void setCodec(ObjectCodec c)

Implements abstract com.fasterxml.jackson.core.JsonParser.setCodec.

Doc from com.fasterxml.jackson.core.JsonParser.setCodec.

Setter that allows defining ObjectCodec associated with this parser, if any. Codec is used by readValueAs(Class) method (and its variants).

Parameters
c:ObjectCodec

Codec to assign, if any; null if none

Annotations
@Override
skipChildrenback to summary
public JsonParser skipChildren() throws IOException

Overrides com.fasterxml.jackson.core.base.ParserMinimalBase.skipChildren.

Doc from com.fasterxml.jackson.core.JsonParser.skipChildren.

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 JsonToken#START_OBJECT or JsonToken#START_ARRAY. If not, it will do nothing. After skipping, stream will point to matching JsonToken#END_OBJECT or JsonToken#END_ARRAY (possibly skipping nested pairs of START/END OBJECT/ARRAY tokens as well as value tokens). The idea is that after calling this method, application will call nextToken to point to the next available token, if any.

Returns:JsonParser

This parser, to allow call chaining

Annotations
@Override
Exceptions
IOException:
for low-level read issues, or JsonParseException for decoding problems
versionback to summary
public Version version()

Implements abstract com.fasterxml.jackson.core.JsonParser.version.

Implements com.fasterxml.jackson.core.Versioned.version.

Doc from com.fasterxml.jackson.core.JsonParser.version.

Accessor for getting version of the core package, given a parser instance. Left for sub-classes to implement.

Returns:Version

Version of this generator (derived from version declared for jackson-core jar that contains the class

Annotations
@Override