|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.fasterxml.jackson.core.JsonParser com.fasterxml.jackson.core.util.JsonParserDelegate com.fasterxml.jackson.core.util.JsonParserSequence
public class JsonParserSequence
Helper class that can be used to sequence multiple physical
JsonParser
s to create a single logical sequence of
tokens, as a single JsonParser
.
Fairly simple use of JsonParserDelegate
: only need
to override nextToken()
to handle transition
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.fasterxml.jackson.core.JsonParser |
---|
JsonParser.Feature, JsonParser.NumberType |
Field Summary | |
---|---|
protected int |
_nextParser
Index of the next parser in _parsers . |
protected JsonParser[] |
_parsers
Parsers other than the first one (which is initially assigned as delegate) |
Fields inherited from class com.fasterxml.jackson.core.util.JsonParserDelegate |
---|
delegate |
Fields inherited from class com.fasterxml.jackson.core.JsonParser |
---|
_features |
Constructor Summary | |
---|---|
protected |
JsonParserSequence(JsonParser[] parsers)
|
Method Summary | |
---|---|
protected void |
addFlattenedActiveParsers(List<JsonParser> result)
|
void |
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 JsonParser.Feature.AUTO_CLOSE_SOURCE is enabled. |
int |
containedParsersCount()
Method that is most useful for debugging or testing; returns actual number of underlying parsers sequence was constructed with (nor just ones remaining active) |
static JsonParserSequence |
createFlattened(JsonParser first,
JsonParser second)
Method that will construct a parser (possibly a sequence) that contains all given sub-parsers. |
JsonToken |
nextToken()
Main iteration method, which will advance stream enough to determine type of the next token, if any. |
protected boolean |
switchToNext()
Method that will switch active parser from the current one to next parser in sequence, if there is another parser left, making this the new delegate. |
Methods inherited from class com.fasterxml.jackson.core.util.JsonParserDelegate |
---|
canUseSchema, clearCurrentToken, disable, enable, getBigIntegerValue, getBinaryValue, getBooleanValue, getByteValue, getCodec, getCurrentLocation, getCurrentName, getCurrentToken, getDecimalValue, getDoubleValue, getEmbeddedObject, getFloatValue, getInputSource, getIntValue, getLastClearedToken, getLongValue, getNumberType, getNumberValue, getParsingContext, getShortValue, getText, getTextCharacters, getTextLength, getTextOffset, getTokenLocation, hasCurrentToken, hasTextCharacters, isClosed, isEnabled, nextValue, setCodec, setSchema, skipChildren, version |
Methods inherited from class com.fasterxml.jackson.core.JsonParser |
---|
_constructError, configure, getBinaryValue, getValueAsBoolean, getValueAsBoolean, getValueAsDouble, getValueAsDouble, getValueAsInt, getValueAsInt, getValueAsLong, getValueAsLong, isExpectedStartArrayToken, nextBooleanValue, nextFieldName, nextIntValue, nextLongValue, nextTextValue, readValueAs, readValueAs, readValueAsTree, readValuesAs, readValuesAs, releaseBuffered, releaseBuffered |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final JsonParser[] _parsers
protected int _nextParser
_parsers
.
Constructor Detail |
---|
protected JsonParserSequence(JsonParser[] parsers)
Method Detail |
---|
public static JsonParserSequence createFlattened(JsonParser first, JsonParser second)
protected void addFlattenedActiveParsers(List<JsonParser> result)
public void close() throws IOException
JsonParser
JsonParser.Feature.AUTO_CLOSE_SOURCE
is enabled.
Whether parser owns the input source depends on factory
method that was used to construct instance (so check
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
File
or URL
and creates
stream or reader it does own them.
close
in interface Closeable
close
in class JsonParserDelegate
IOException
public JsonToken nextToken() throws IOException, JsonParseException
JsonParser
nextToken
in class JsonParserDelegate
IOException
JsonParseException
public int containedParsersCount()
protected boolean switchToNext()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |