Package com.fasterxml.jackson.core.util
Class JsonParserSequence
- java.lang.Object
 - 
- com.fasterxml.jackson.core.JsonParser
 - 
- com.fasterxml.jackson.core.util.JsonParserDelegate
 - 
- com.fasterxml.jackson.core.util.JsonParserSequence
 
 
 
 
- 
- All Implemented Interfaces:
 Versioned,java.io.Closeable,java.lang.AutoCloseable
public class JsonParserSequence extends JsonParserDelegate
Helper class that can be used to sequence multiple physicalJsonParsers to create a single logical sequence of tokens, as a singleJsonParser.Fairly simple use of
JsonParserDelegate: only need to overridenextToken()to handle transition 
- 
- 
Nested Class Summary
- 
Nested classes/interfaces inherited from class com.fasterxml.jackson.core.JsonParser
JsonParser.Feature, JsonParser.NumberType 
 - 
 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidclose()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 featureJsonParser.Feature.AUTO_CLOSE_SOURCEis enabled.intcontainedParsersCount()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 JsonParserSequencecreateFlattened(boolean checkForExistingToken, JsonParser first, JsonParser second)Method that will construct a sequence (possibly a sequence) that contains all given sub-parsers.static JsonParserSequencecreateFlattened(JsonParser first, JsonParser second)Deprecated.JsonTokennextToken()Main iteration method, which will advance stream enough to determine type of the next token, if any.JsonParserskipChildren()Need to override, re-implement similar to how method defined inParserMinimalBase, to keep state correct here.- 
Methods inherited from class com.fasterxml.jackson.core.util.JsonParserDelegate
assignCurrentValue, canReadObjectId, canReadTypeId, canUseSchema, clearCurrentToken, currentLocation, currentName, currentToken, currentTokenId, currentTokenLocation, currentValue, delegate, disable, enable, finishToken, getBigIntegerValue, getBinaryValue, getBooleanValue, getByteValue, getCodec, getCurrentLocation, getCurrentName, getCurrentToken, getCurrentTokenId, getCurrentValue, getDecimalValue, getDoubleValue, getEmbeddedObject, getFeatureMask, getFloatValue, getInputSource, getIntValue, getLastClearedToken, getLongValue, getNumberType, getNumberValue, getNumberValueExact, getObjectId, getParsingContext, getReadCapabilities, getSchema, getShortValue, getText, getText, getTextCharacters, getTextLength, getTextOffset, getTokenLocation, getTypeId, getValueAsBoolean, getValueAsBoolean, getValueAsDouble, getValueAsDouble, getValueAsInt, getValueAsInt, getValueAsLong, getValueAsLong, getValueAsString, getValueAsString, hasCurrentToken, hasTextCharacters, hasToken, hasTokenId, isClosed, isEnabled, isExpectedNumberIntToken, isExpectedStartArrayToken, isExpectedStartObjectToken, isNaN, nextValue, overrideCurrentName, overrideFormatFeatures, overrideStdFeatures, readBinaryValue, requiresCustomCodec, setCodec, setCurrentValue, setFeatureMask, setSchema, version 
- 
Methods inherited from class com.fasterxml.jackson.core.JsonParser
canParseAsync, configure, getBinaryValue, getFormatFeatures, getNonBlockingInputFeeder, isEnabled, nextBooleanValue, nextFieldName, nextFieldName, nextIntValue, nextLongValue, nextTextValue, readBinaryValue, readValueAs, readValueAs, readValueAsTree, readValuesAs, readValuesAs, releaseBuffered, releaseBuffered, setRequestPayloadOnError, setRequestPayloadOnError, setRequestPayloadOnError 
 - 
 
 - 
 
- 
- 
Method Detail
- 
createFlattened
public static JsonParserSequence createFlattened(boolean checkForExistingToken, JsonParser first, JsonParser second)
Method that will construct a sequence (possibly a sequence) that contains all given sub-parsers. All parsers given are checked to see if they are sequences: and if so, they will be "flattened", that is, contained parsers are directly added in a new sequence instead of adding sequences within sequences. This is done to minimize delegation depth, ideally only having just a single level of delegation.- Parameters:
 checkForExistingToken- Flag passed to be assigned as_checkForExistingTokenfor resulting sequencefirst- First parser to traversesecond- Second parser to traverse- Returns:
 - Sequence instance constructed
 
 
- 
createFlattened
@Deprecated public static JsonParserSequence createFlattened(JsonParser first, JsonParser second)
Deprecated. 
- 
close
public void close() throws java.io.IOExceptionDescription copied from class:JsonParserCloses 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 featureJsonParser.Feature.AUTO_CLOSE_SOURCEis enabled. Whether parser owns the input source depends on factory method that was used to construct instance (so checkJsonFactoryfor details, but the general idea is that if caller passes in closable resource (such asInputStreamorReader) parser does NOT own the source; but if it passes a reference (such asFileorURLand creates stream or reader it does own them.- Specified by:
 closein interfacejava.lang.AutoCloseable- Specified by:
 closein interfacejava.io.Closeable- Overrides:
 closein classJsonParserDelegate- Throws:
 java.io.IOException- if there is either an underlying I/O problem
 
- 
nextToken
public JsonToken nextToken() throws java.io.IOException
Description copied from class:JsonParserMain 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.- Overrides:
 nextTokenin classJsonParserDelegate- Returns:
 - Next token from the stream, if any found, or null to indicate end-of-input
 - Throws:
 java.io.IOException- for low-level read issues, orJsonParseExceptionfor decoding problems
 
- 
skipChildren
public JsonParser skipChildren() throws java.io.IOException
Need to override, re-implement similar to how method defined inParserMinimalBase, to keep state correct here.- Overrides:
 skipChildrenin classJsonParserDelegate- Returns:
 - This parser, to allow call chaining
 - Throws:
 java.io.IOException- for low-level read issues, orJsonParseExceptionfor decoding problems
 
- 
containedParsersCount
public 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)- Returns:
 - Number of actual underlying parsers this sequence has
 
 
 - 
 
 -