java.lang.Object
tools.jackson.core.JsonParser
tools.jackson.core.base.ParserMinimalBase
tools.jackson.databind.node.TreeTraversingParser
- All Implemented Interfaces:
Closeable
,AutoCloseable
,tools.jackson.core.Versioned
public class TreeTraversingParser
extends tools.jackson.core.base.ParserMinimalBase
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.-
Nested Class Summary
Nested classes/interfaces inherited from class tools.jackson.core.JsonParser
tools.jackson.core.JsonParser.NumberType, tools.jackson.core.JsonParser.NumberTypeFP
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
Flag that indicates whether parser is closed or not.protected tools.jackson.databind.node.NodeCursor
Traversal context within treeprotected final JsonNode
Fields inherited from class tools.jackson.core.base.ParserMinimalBase
_currToken, _ioContext, _lastClearedToken, _objectReadContext, _streamReadConstraints, _streamReadFeatures, _tokenCount, _trackMaxTokenCount, BD_MAX_INT, BD_MAX_LONG, BD_MIN_INT, BD_MIN_LONG, BI_MAX_INT, BI_MAX_LONG, BI_MIN_INT, BI_MIN_LONG, CHAR_NULL, INT_0, INT_9, INT_APOS, INT_ASTERISK, INT_BACKSLASH, INT_COLON, INT_COMMA, INT_CR, INT_e, INT_E, INT_HASH, INT_LBRACKET, INT_LCURLY, INT_LF, INT_MINUS, INT_PERIOD, INT_PLUS, INT_QUOTE, INT_RBRACKET, INT_RCURLY, INT_SLASH, INT_SPACE, INT_TAB, MAX_BYTE_I, MAX_INT_D, MAX_INT_L, MAX_LONG_D, MAX_SHORT_I, MIN_BYTE_I, MIN_INT_D, MIN_INT_L, MIN_LONG_D, MIN_SHORT_I, NO_BYTES, NO_INTS, NR_BIGDECIMAL, NR_BIGINT, NR_DOUBLE, NR_FLOAT, NR_INT, NR_LONG, NR_UNKNOWN, STREAM_READ_FEATURE_DEFAULTS
Fields inherited from class tools.jackson.core.JsonParser
DEFAULT_READ_CAPABILITIES
-
Constructor Summary
ConstructorsConstructorDescriptionTreeTraversingParser
(JsonNode n, tools.jackson.core.ObjectReadContext readContext) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected void
protected void
void
void
close()
tools.jackson.core.TokenStreamLocation
protected JsonNode
protected JsonNode
currentNumericNode
(int targetNumType) tools.jackson.core.TokenStreamLocation
byte[]
getBinaryValue
(tools.jackson.core.Base64Variant b64variant) double
float
int
long
tools.jackson.core.JsonParser.NumberType
tools.jackson.core.JsonParser.NumberTypeFP
char[]
int
int
boolean
boolean
isClosed()
boolean
isNaN()
tools.jackson.core.JsonToken
int
readBinaryValue
(tools.jackson.core.Base64Variant b64variant, OutputStream out) tools.jackson.core.JsonParser
tools.jackson.core.util.JacksonFeatureSet<tools.jackson.core.StreamReadCapability>
tools.jackson.core.TokenStreamContext
tools.jackson.core.Version
version()
Methods inherited from class tools.jackson.core.base.ParserMinimalBase
_constructInputCoercion, _constructNotNumericType, _currentLocationMinusOne, _decodeBase64, _getCharDesc, _hasTextualNull, _longIntegerDesc, _longNumberDesc, _nullSafeUpdateToken, _reportBadInputStream, _reportBadReader, _reportError, _reportError, _reportError, _reportError, _reportInvalidEOF, _reportInvalidEOF, _reportInvalidEOFInValue, _reportInvalidNumber, _reportInvalidSpace, _reportMissingRootWS, _reportOverflowByte, _reportOverflowInt, _reportOverflowInt, _reportOverflowInt, _reportOverflowLong, _reportOverflowLong, _reportOverflowLong, _reportOverflowShort, _reportUnexpectedChar, _reportUnexpectedNumberChar, _throwInternal, _updateToken, _updateTokenToNA, _updateTokenToNull, _wrapIOFailure, clearCurrentToken, currentNameMatch, currentToken, currentTokenCount, currentTokenId, finishToken, getBooleanValue, getByteValue, getLastClearedToken, getNumberValueDeferred, getNumberValueExact, getShortValue, getString, getValueAsBoolean, getValueAsDouble, getValueAsInt, getValueAsInt, getValueAsLong, getValueAsLong, getValueAsString, getValueAsString, hasCurrentToken, hasToken, hasTokenId, isEnabled, isExpectedNumberIntToken, isExpectedStartArrayToken, isExpectedStartObjectToken, nextName, nextName, nextNameMatch, nextValue, objectReadContext, readValueAs, readValueAs, readValueAs, readValueAsTree, streamReadConstraints, streamReadFeatures
Methods inherited from class tools.jackson.core.JsonParser
_constructReadException, _constructReadException, _constructReadException, _constructReadException, _constructReadException, _constructReadException, _reportUnsupportedOperation, canParseAsync, canReadObjectId, canReadTypeId, getBinaryValue, getObjectId, getSchema, getText, getTextCharacters, getTextLength, getTextOffset, getTypeId, getValueAsBoolean, getValueAsDouble, nextBooleanValue, nextIntValue, nextLongValue, nextStringValue, nonBlockingInputFeeder, readBinaryValue, releaseBuffered, releaseBuffered
-
Field Details
-
_source
- Since:
- 3.0
-
_nodeCursor
protected tools.jackson.databind.node.NodeCursor _nodeCursorTraversal context within tree -
_closed
protected boolean _closedFlag 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.
-
-
Constructor Details
-
TreeTraversingParser
-
TreeTraversingParser
-
-
Method Details
-
version
public tools.jackson.core.Version version()- Specified by:
version
in interfacetools.jackson.core.Versioned
- Specified by:
version
in classtools.jackson.core.JsonParser
-
streamReadCapabilities
public tools.jackson.core.util.JacksonFeatureSet<tools.jackson.core.StreamReadCapability> streamReadCapabilities()- Overrides:
streamReadCapabilities
in classtools.jackson.core.base.ParserMinimalBase
-
streamReadInputSource
- Specified by:
streamReadInputSource
in classtools.jackson.core.JsonParser
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classtools.jackson.core.base.ParserMinimalBase
-
_closeInput
- Specified by:
_closeInput
in classtools.jackson.core.base.ParserMinimalBase
- Throws:
IOException
-
_releaseBuffers
protected void _releaseBuffers()- Specified by:
_releaseBuffers
in classtools.jackson.core.base.ParserMinimalBase
-
nextToken
public tools.jackson.core.JsonToken nextToken()- Specified by:
nextToken
in classtools.jackson.core.JsonParser
-
skipChildren
public tools.jackson.core.JsonParser skipChildren()- Overrides:
skipChildren
in classtools.jackson.core.base.ParserMinimalBase
-
isClosed
public boolean isClosed()- Overrides:
isClosed
in classtools.jackson.core.base.ParserMinimalBase
-
currentName
- Specified by:
currentName
in classtools.jackson.core.JsonParser
-
streamReadContext
public tools.jackson.core.TokenStreamContext streamReadContext()- Specified by:
streamReadContext
in classtools.jackson.core.JsonParser
-
assignCurrentValue
- Specified by:
assignCurrentValue
in classtools.jackson.core.JsonParser
-
currentValue
- Specified by:
currentValue
in classtools.jackson.core.JsonParser
-
currentTokenLocation
public tools.jackson.core.TokenStreamLocation currentTokenLocation()- Specified by:
currentTokenLocation
in classtools.jackson.core.JsonParser
-
currentLocation
public tools.jackson.core.TokenStreamLocation currentLocation()- Specified by:
currentLocation
in classtools.jackson.core.JsonParser
-
getString
- Specified by:
getString
in classtools.jackson.core.JsonParser
-
getStringCharacters
public char[] getStringCharacters()- Specified by:
getStringCharacters
in classtools.jackson.core.JsonParser
-
getStringLength
public int getStringLength()- Specified by:
getStringLength
in classtools.jackson.core.JsonParser
-
getStringOffset
public int getStringOffset()- Specified by:
getStringOffset
in classtools.jackson.core.JsonParser
-
hasStringCharacters
public boolean hasStringCharacters()- Specified by:
hasStringCharacters
in classtools.jackson.core.JsonParser
-
getNumberType
public tools.jackson.core.JsonParser.NumberType getNumberType()- Specified by:
getNumberType
in classtools.jackson.core.JsonParser
-
getNumberTypeFP
public tools.jackson.core.JsonParser.NumberTypeFP getNumberTypeFP()- Overrides:
getNumberTypeFP
in classtools.jackson.core.base.ParserMinimalBase
-
getBigIntegerValue
- Specified by:
getBigIntegerValue
in classtools.jackson.core.JsonParser
- Throws:
tools.jackson.core.exc.InputCoercionException
-
getDecimalValue
- Specified by:
getDecimalValue
in classtools.jackson.core.JsonParser
- Throws:
tools.jackson.core.exc.InputCoercionException
-
getDoubleValue
public double getDoubleValue() throws tools.jackson.core.exc.InputCoercionException- Specified by:
getDoubleValue
in classtools.jackson.core.JsonParser
- Throws:
tools.jackson.core.exc.InputCoercionException
-
getFloatValue
public float getFloatValue() throws tools.jackson.core.exc.InputCoercionException- Specified by:
getFloatValue
in classtools.jackson.core.JsonParser
- Throws:
tools.jackson.core.exc.InputCoercionException
-
getIntValue
public int getIntValue() throws tools.jackson.core.exc.InputCoercionException- Specified by:
getIntValue
in classtools.jackson.core.JsonParser
- Throws:
tools.jackson.core.exc.InputCoercionException
-
getLongValue
public long getLongValue() throws tools.jackson.core.exc.InputCoercionException- Specified by:
getLongValue
in classtools.jackson.core.JsonParser
- Throws:
tools.jackson.core.exc.InputCoercionException
-
getNumberValue
- Specified by:
getNumberValue
in classtools.jackson.core.JsonParser
- Throws:
tools.jackson.core.exc.InputCoercionException
-
getEmbeddedObject
- Overrides:
getEmbeddedObject
in classtools.jackson.core.base.ParserMinimalBase
-
isNaN
public boolean isNaN()- Specified by:
isNaN
in classtools.jackson.core.JsonParser
-
getBinaryValue
public byte[] getBinaryValue(tools.jackson.core.Base64Variant b64variant) throws tools.jackson.core.JacksonException - Specified by:
getBinaryValue
in classtools.jackson.core.JsonParser
- Throws:
tools.jackson.core.JacksonException
-
readBinaryValue
public int readBinaryValue(tools.jackson.core.Base64Variant b64variant, OutputStream out) throws tools.jackson.core.JacksonException - Overrides:
readBinaryValue
in classtools.jackson.core.JsonParser
- Throws:
tools.jackson.core.JacksonException
-
currentNode
-
currentNumericNode
-
_handleEOF
protected void _handleEOF()- Specified by:
_handleEOF
in classtools.jackson.core.base.ParserMinimalBase
-