com.fasterxml.jackson.databind.node
Class TreeTraversingParser
java.lang.Object
com.fasterxml.jackson.core.JsonParser
com.fasterxml.jackson.core.base.ParserMinimalBase
com.fasterxml.jackson.databind.node.TreeTraversingParser
- All Implemented Interfaces:
- Versioned, Closeable
public class TreeTraversingParser
- extends 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.
- Author:
- tatu
Field Summary |
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 com.fasterxml.jackson.databind.node.NodeCursor |
_nodeCursor
Traversal context within tree |
protected ObjectCodec |
_objectCodec
|
protected boolean |
_startContainer
Flag needed to handle recursion into contents of child
Array/Object nodes. |
Fields inherited from class com.fasterxml.jackson.core.base.ParserMinimalBase |
_currToken, _lastClearedToken, INT_APOSTROPHE, INT_ASTERISK, INT_b, INT_BACKSLASH, INT_COLON, INT_COMMA, INT_CR, INT_f, INT_LBRACKET, INT_LCURLY, INT_LF, INT_n, INT_QUOTE, INT_r, INT_RBRACKET, INT_RCURLY, INT_SLASH, INT_SPACE, INT_t, INT_TAB, INT_u |
Methods inherited from class com.fasterxml.jackson.core.base.ParserMinimalBase |
_constructError, _decodeBase64, _getCharDesc, _handleUnrecognizedCharacterEscape, _reportBase64EOF, _reportError, _reportInvalidBase64, _reportInvalidEOF, _reportInvalidEOF, _reportInvalidEOFInValue, _reportUnexpectedChar, _throwInternal, _throwInvalidSpace, _throwUnquotedSpace, _wrapError, clearCurrentToken, getCurrentToken, getLastClearedToken, getValueAsBoolean, getValueAsDouble, getValueAsInt, getValueAsLong, getValueAsString, hasCurrentToken, nextValue |
Methods inherited from class com.fasterxml.jackson.core.JsonParser |
_constructError, _reportUnsupportedOperation, canUseSchema, configure, disable, enable, getBinaryValue, getBooleanValue, getByteValue, getInputSource, getSchema, getShortValue, getValueAsBoolean, getValueAsDouble, getValueAsInt, getValueAsLong, getValueAsString, isEnabled, isExpectedStartArrayToken, nextBooleanValue, nextFieldName, nextIntValue, nextLongValue, nextTextValue, readBinaryValue, readValueAs, readValueAs, readValueAsTree, readValuesAs, readValuesAs, releaseBuffered, releaseBuffered, requiresCustomCodec, setSchema |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
_objectCodec
protected ObjectCodec _objectCodec
_nodeCursor
protected com.fasterxml.jackson.databind.node.NodeCursor _nodeCursor
- Traversal context within tree
_nextToken
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
_startContainer
protected boolean _startContainer
- Flag needed to handle recursion into contents of child
Array/Object nodes.
_closed
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.
TreeTraversingParser
public TreeTraversingParser(JsonNode n)
TreeTraversingParser
public TreeTraversingParser(JsonNode n,
ObjectCodec codec)
setCodec
public void setCodec(ObjectCodec c)
- Specified by:
setCodec
in class JsonParser
getCodec
public ObjectCodec getCodec()
- Specified by:
getCodec
in class JsonParser
version
public Version version()
- Specified by:
version
in interface Versioned
- Overrides:
version
in class ParserMinimalBase
close
public void close()
throws IOException
- Specified by:
close
in interface Closeable
- Specified by:
close
in class ParserMinimalBase
- Throws:
IOException
nextToken
public JsonToken nextToken()
throws IOException,
JsonParseException
- Specified by:
nextToken
in class ParserMinimalBase
- Throws:
IOException
JsonParseException
skipChildren
public JsonParser skipChildren()
throws IOException,
JsonParseException
- Overrides:
skipChildren
in class ParserMinimalBase
- Throws:
IOException
JsonParseException
isClosed
public boolean isClosed()
- Specified by:
isClosed
in class ParserMinimalBase
getCurrentName
public String getCurrentName()
- Specified by:
getCurrentName
in class ParserMinimalBase
overrideCurrentName
public void overrideCurrentName(String name)
- Specified by:
overrideCurrentName
in class ParserMinimalBase
getParsingContext
public JsonStreamContext getParsingContext()
- Specified by:
getParsingContext
in class ParserMinimalBase
getTokenLocation
public JsonLocation getTokenLocation()
- Specified by:
getTokenLocation
in class JsonParser
getCurrentLocation
public JsonLocation getCurrentLocation()
- Specified by:
getCurrentLocation
in class JsonParser
getText
public String getText()
- Specified by:
getText
in class ParserMinimalBase
getTextCharacters
public char[] getTextCharacters()
throws IOException,
JsonParseException
- Specified by:
getTextCharacters
in class ParserMinimalBase
- Throws:
IOException
JsonParseException
getTextLength
public int getTextLength()
throws IOException,
JsonParseException
- Specified by:
getTextLength
in class ParserMinimalBase
- Throws:
IOException
JsonParseException
getTextOffset
public int getTextOffset()
throws IOException,
JsonParseException
- Specified by:
getTextOffset
in class ParserMinimalBase
- Throws:
IOException
JsonParseException
hasTextCharacters
public boolean hasTextCharacters()
- Specified by:
hasTextCharacters
in class ParserMinimalBase
getNumberType
public JsonParser.NumberType getNumberType()
throws IOException,
JsonParseException
- Specified by:
getNumberType
in class JsonParser
- Throws:
IOException
JsonParseException
getBigIntegerValue
public BigInteger getBigIntegerValue()
throws IOException,
JsonParseException
- Specified by:
getBigIntegerValue
in class JsonParser
- Throws:
IOException
JsonParseException
getDecimalValue
public BigDecimal getDecimalValue()
throws IOException,
JsonParseException
- Specified by:
getDecimalValue
in class JsonParser
- Throws:
IOException
JsonParseException
getDoubleValue
public double getDoubleValue()
throws IOException,
JsonParseException
- Specified by:
getDoubleValue
in class JsonParser
- Throws:
IOException
JsonParseException
getFloatValue
public float getFloatValue()
throws IOException,
JsonParseException
- Specified by:
getFloatValue
in class JsonParser
- Throws:
IOException
JsonParseException
getLongValue
public long getLongValue()
throws IOException,
JsonParseException
- Specified by:
getLongValue
in class JsonParser
- Throws:
IOException
JsonParseException
getIntValue
public int getIntValue()
throws IOException,
JsonParseException
- Specified by:
getIntValue
in class JsonParser
- Throws:
IOException
JsonParseException
getNumberValue
public Number getNumberValue()
throws IOException,
JsonParseException
- Specified by:
getNumberValue
in class JsonParser
- Throws:
IOException
JsonParseException
getEmbeddedObject
public Object getEmbeddedObject()
- Specified by:
getEmbeddedObject
in class JsonParser
getBinaryValue
public byte[] getBinaryValue(Base64Variant b64variant)
throws IOException,
JsonParseException
- Specified by:
getBinaryValue
in class ParserMinimalBase
- Throws:
IOException
JsonParseException
readBinaryValue
public int readBinaryValue(Base64Variant b64variant,
OutputStream out)
throws IOException,
JsonParseException
- Overrides:
readBinaryValue
in class JsonParser
- Throws:
IOException
JsonParseException
currentNode
protected JsonNode currentNode()
currentNumericNode
protected JsonNode currentNumericNode()
throws JsonParseException
- Throws:
JsonParseException
_handleEOF
protected void _handleEOF()
throws JsonParseException
- Specified by:
_handleEOF
in class ParserMinimalBase
- Throws:
JsonParseException
Copyright © 2012 FasterXML. All Rights Reserved.