java.lang.Object
tools.jackson.core.JsonParser
tools.jackson.core.base.ParserMinimalBase
tools.jackson.core.base.ParserBase
tools.jackson.dataformat.yaml.YAMLParser
- All Implemented Interfaces:
Closeable,AutoCloseable,tools.jackson.core.Versioned
public class YAMLParser
extends tools.jackson.core.base.ParserBase
JsonParser implementation used to expose YAML documents
in form that allows other Jackson functionality to process YAML content,
such as binding POJOs to and from it, and building tree representations.-
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 final booleanprotected StringFor some tokens (specifically, numbers), we'll have cleaned up version, mostly free of underscoresprotected Optional<org.snakeyaml.engine.v2.common.Anchor>Anchor for the value that parser currently points to: in case of structured types, value whose first token current token is.protected booleanFlag that is set when current token was derived from an Alias (reference to another value's anchor)protected StringLet's also have a local copy of the current property nameprotected final intprotected org.snakeyaml.engine.v2.events.EventKeep track of the last event read, to get access to Location infoprotected org.snakeyaml.engine.v2.events.EventTo keep track of tags ("type ids"), need to either get tags for all events, or, keep tag of relevant event that might have it: this is different from_lastEventin some cases.protected final ReaderNeed to keep track of underlyingReaderto be able to auto-close it (if required to)protected tools.jackson.core.util.SimpleStreamReadContextInformation about parser context, context in which the next token is to be parsed (root, array, object).protected StringWe need to keep track of text values.protected final org.snakeyaml.engine.v2.parser.ParserImplprotected final org.snakeyaml.engine.v2.resolver.ScalarResolverFields inherited from class tools.jackson.core.base.ParserBase
_binaryValue, _byteArrayBuilder, _currInputProcessed, _currInputRow, _currInputRowStart, _expLength, _fractLength, _inputEnd, _inputPtr, _intLength, _numberBigDecimal, _numberBigInt, _numberDouble, _numberFloat, _numberInt, _numberIsNaN, _numberLong, _numberNegative, _numberString, _numTypesValid, _textBuffer, _tokenInputCol, _tokenInputRow, _tokenInputTotalFields inherited from class tools.jackson.core.base.ParserMinimalBase
_closed, _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_RS, 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_DEFAULTSFields inherited from class tools.jackson.core.JsonParser
DEFAULT_READ_CAPABILITIES -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedYAMLParser(tools.jackson.core.ObjectReadContext readCtxt, tools.jackson.core.io.IOContext ioCtxt, tools.jackson.core.util.BufferRecycler br, int streamReadFeatures, int formatFeatures, Reader reader, org.snakeyaml.engine.v2.parser.ParserImpl yamlParser) YAMLParser(tools.jackson.core.ObjectReadContext readCtxt, tools.jackson.core.io.IOContext ioCtxt, tools.jackson.core.util.BufferRecycler br, int streamReadFeatures, int formatFeatures, org.snakeyaml.engine.v2.api.LoadSettings loadSettings, Reader reader) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected tools.jackson.core.JsonToken_decodeNumberIntBinary(String value, int i, int origLen, boolean negative) protected tools.jackson.core.JsonToken_decodeNumberIntHex(String value, int i, int origLen, boolean negative) protected tools.jackson.core.JsonToken_decodeNumberIntOctal(String value, int i, int origLen, boolean negative) protected tools.jackson.core.JsonToken_decodeNumberScalar(String value, int len) protected tools.jackson.core.JsonToken_decodeScalar(org.snakeyaml.engine.v2.events.ScalarEvent scalar) protected tools.jackson.core.TokenStreamLocation_locationFor(Optional<org.snakeyaml.engine.v2.exceptions.Mark> option) protected Boolean_matchYAMLBoolean(String value, int len) protected intprotected void_parseNumericValue(int expType) protected void_reportMismatchedEndMarker(int actCh, char expCh) voidbooleanbooleantools.jackson.core.TokenStreamLocationtools.jackson.core.TokenStreamLocationintchar[]intintbooleanbooleanMethod that can be used to check whether current token was created from YAML Alias token (reference to an anchor).booleanMethod for checking whether specifiedYAMLReadFeatureis enabled.protected org.snakeyaml.engine.v2.events.Eventtools.jackson.core.JsonTokenintreadBinaryValue(tools.jackson.core.Base64Variant b64variant, OutputStream out) tools.jackson.core.util.JacksonFeatureSet<tools.jackson.core.StreamReadCapability>tools.jackson.core.TokenStreamContexttools.jackson.core.Versionversion()Methods inherited from class tools.jackson.core.base.ParserBase
_contentReference, _contentReferenceRedacted, _convertBigDecimalToBigInteger, _decodeBase64Escape, _decodeBase64Escape, _decodeEscaped, _eofAsNextChar, _getBigDecimal, _getBigInteger, _getByteArrayBuilder, _getNumberDouble, _getNumberFloat, _growNameDecodeBuffer, _handleBase64MissingPadding, _handleEOF, _releaseBuffers, _reportInvalidBase64Char, _reportInvalidBase64Char, close, convertNumberToBigDecimal, convertNumberToBigInteger, convertNumberToDouble, convertNumberToFloat, convertNumberToInt, convertNumberToLong, getBigIntegerValue, getBinaryValue, getDecimalValue, getDoubleValue, getFloatValue, getIntValue, getLongValue, getNumberType, getNumberValue, getNumberValueExact, getTokenCharacterOffset, getTokenColumnNr, getTokenLineNr, growArrayBy, isNaN, reset, resetAsNaN, resetFloat, resetIntMethods 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, _reportInvalidUTF8Surrogate, _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, getNumberTypeFP, getShortValue, getValueAsBoolean, getValueAsDouble, getValueAsInt, getValueAsInt, getValueAsLong, getValueAsLong, getValueAsString, getValueAsString, hasCurrentToken, hasToken, hasTokenId, isClosed, isEnabled, isExpectedNumberIntToken, isExpectedStartArrayToken, isExpectedStartObjectToken, nextName, nextName, nextNameMatch, nextValue, objectReadContext, readValueAs, readValueAs, readValueAs, readValueAsTree, skipChildren, streamReadConstraints, streamReadFeaturesMethods inherited from class tools.jackson.core.JsonParser
_constructReadException, _constructReadException, _constructReadException, _constructReadException, _constructReadException, _constructReadException, _reportUnsupportedOperation, canParseAsync, getBinaryValue, getSchema, getText, getTextCharacters, getTextLength, getTextOffset, getValueAsBoolean, getValueAsDouble, nextBooleanValue, nextIntValue, nextLongValue, nextStringValue, nonBlockingInputFeeder, readBinaryValue, releaseBuffered, releaseBuffered
-
Field Details
-
_formatFeatures
protected final int _formatFeatures -
_cfgEmptyStringsToNull
protected final boolean _cfgEmptyStringsToNull -
_reader
Need to keep track of underlyingReaderto be able to auto-close it (if required to) -
_yamlParser
protected final org.snakeyaml.engine.v2.parser.ParserImpl _yamlParser -
_yamlResolver
protected final org.snakeyaml.engine.v2.resolver.ScalarResolver _yamlResolver -
_streamReadContext
protected tools.jackson.core.util.SimpleStreamReadContext _streamReadContextInformation about parser context, context in which the next token is to be parsed (root, array, object). -
_lastEvent
protected org.snakeyaml.engine.v2.events.Event _lastEventKeep track of the last event read, to get access to Location info -
_lastTagEvent
protected org.snakeyaml.engine.v2.events.Event _lastTagEventTo keep track of tags ("type ids"), need to either get tags for all events, or, keep tag of relevant event that might have it: this is different from_lastEventin some cases. -
_textValue
We need to keep track of text values. -
_cleanedTextValue
For some tokens (specifically, numbers), we'll have cleaned up version, mostly free of underscores -
_currentName
Let's also have a local copy of the current property name -
_currentIsAlias
protected boolean _currentIsAliasFlag that is set when current token was derived from an Alias (reference to another value's anchor) -
_currentAnchor
Anchor for the value that parser currently points to: in case of structured types, value whose first token current token is.
-
-
Constructor Details
-
YAMLParser
public YAMLParser(tools.jackson.core.ObjectReadContext readCtxt, tools.jackson.core.io.IOContext ioCtxt, tools.jackson.core.util.BufferRecycler br, int streamReadFeatures, int formatFeatures, org.snakeyaml.engine.v2.api.LoadSettings loadSettings, Reader reader) -
YAMLParser
protected YAMLParser(tools.jackson.core.ObjectReadContext readCtxt, tools.jackson.core.io.IOContext ioCtxt, tools.jackson.core.util.BufferRecycler br, int streamReadFeatures, int formatFeatures, Reader reader, org.snakeyaml.engine.v2.parser.ParserImpl yamlParser)
-
-
Method Details
-
version
public tools.jackson.core.Version version()- Specified by:
versionin interfacetools.jackson.core.Versioned- Specified by:
versionin classtools.jackson.core.JsonParser
-
isCurrentAlias
public boolean isCurrentAlias()Method that can be used to check whether current token was created from YAML Alias token (reference to an anchor). -
canReadObjectId
public boolean canReadObjectId()- Overrides:
canReadObjectIdin classtools.jackson.core.JsonParser
-
canReadTypeId
public boolean canReadTypeId()- Overrides:
canReadTypeIdin classtools.jackson.core.JsonParser
-
streamReadCapabilities
public tools.jackson.core.util.JacksonFeatureSet<tools.jackson.core.StreamReadCapability> streamReadCapabilities()- Overrides:
streamReadCapabilitiesin classtools.jackson.core.base.ParserMinimalBase
-
streamReadInputSource
- Specified by:
streamReadInputSourcein classtools.jackson.core.JsonParser
-
_closeInput
- Specified by:
_closeInputin classtools.jackson.core.base.ParserMinimalBase- Throws:
IOException
-
streamReadContext
public tools.jackson.core.TokenStreamContext streamReadContext()- Specified by:
streamReadContextin classtools.jackson.core.JsonParser
-
assignCurrentValue
- Overrides:
assignCurrentValuein classtools.jackson.core.base.ParserBase
-
currentValue
- Overrides:
currentValuein classtools.jackson.core.base.ParserBase
-
isEnabled
Method for checking whether specifiedYAMLReadFeatureis enabled. -
currentTokenLocation
public tools.jackson.core.TokenStreamLocation currentTokenLocation()- Specified by:
currentTokenLocationin classtools.jackson.core.JsonParser
-
currentLocation
public tools.jackson.core.TokenStreamLocation currentLocation()- Specified by:
currentLocationin classtools.jackson.core.JsonParser
-
_locationFor
protected tools.jackson.core.TokenStreamLocation _locationFor(Optional<org.snakeyaml.engine.v2.exceptions.Mark> option) -
nextToken
public tools.jackson.core.JsonToken nextToken() throws tools.jackson.core.JacksonException- Specified by:
nextTokenin classtools.jackson.core.JsonParser- Throws:
tools.jackson.core.JacksonException
-
nextEvent
protected org.snakeyaml.engine.v2.events.Event nextEvent() -
_decodeScalar
protected tools.jackson.core.JsonToken _decodeScalar(org.snakeyaml.engine.v2.events.ScalarEvent scalar) throws tools.jackson.core.JacksonException - Throws:
tools.jackson.core.JacksonException
-
_matchYAMLBoolean
-
_decodeNumberScalar
protected tools.jackson.core.JsonToken _decodeNumberScalar(String value, int len) throws tools.jackson.core.JacksonException - Throws:
tools.jackson.core.JacksonException
-
_decodeNumberIntBinary
protected tools.jackson.core.JsonToken _decodeNumberIntBinary(String value, int i, int origLen, boolean negative) throws tools.jackson.core.JacksonException - Throws:
tools.jackson.core.JacksonException
-
_decodeNumberIntOctal
protected tools.jackson.core.JsonToken _decodeNumberIntOctal(String value, int i, int origLen, boolean negative) throws tools.jackson.core.JacksonException - Throws:
tools.jackson.core.JacksonException
-
_decodeNumberIntHex
protected tools.jackson.core.JsonToken _decodeNumberIntHex(String value, int i, int origLen, boolean negative) throws tools.jackson.core.JacksonException - Throws:
tools.jackson.core.JacksonException
-
hasStringCharacters
public boolean hasStringCharacters()- Overrides:
hasStringCharactersin classtools.jackson.core.base.ParserBase
-
getString
- Specified by:
getStringin classtools.jackson.core.JsonParser- Throws:
tools.jackson.core.JacksonException
-
currentName
- Specified by:
currentNamein classtools.jackson.core.JsonParser- Throws:
tools.jackson.core.JacksonException
-
getStringCharacters
public char[] getStringCharacters() throws tools.jackson.core.JacksonException- Specified by:
getStringCharactersin classtools.jackson.core.JsonParser- Throws:
tools.jackson.core.JacksonException
-
getStringLength
public int getStringLength() throws tools.jackson.core.JacksonException- Specified by:
getStringLengthin classtools.jackson.core.JsonParser- Throws:
tools.jackson.core.JacksonException
-
getStringOffset
public int getStringOffset() throws tools.jackson.core.JacksonException- Specified by:
getStringOffsetin classtools.jackson.core.JsonParser- Throws:
tools.jackson.core.JacksonException
-
getString
- Overrides:
getStringin classtools.jackson.core.base.ParserMinimalBase- Throws:
tools.jackson.core.JacksonException
-
getEmbeddedObject
- Overrides:
getEmbeddedObjectin classtools.jackson.core.base.ParserMinimalBase- Throws:
tools.jackson.core.JacksonException
-
readBinaryValue
public int readBinaryValue(tools.jackson.core.Base64Variant b64variant, OutputStream out) throws tools.jackson.core.JacksonException - Overrides:
readBinaryValuein classtools.jackson.core.JsonParser- Throws:
tools.jackson.core.JacksonException
-
getNumberValueDeferred
- Overrides:
getNumberValueDeferredin classtools.jackson.core.base.ParserBase- Throws:
tools.jackson.core.JacksonException
-
_parseNumericValue
protected void _parseNumericValue(int expType) throws tools.jackson.core.JacksonException - Specified by:
_parseNumericValuein classtools.jackson.core.base.ParserBase- Throws:
tools.jackson.core.JacksonException
-
_parseIntValue
protected int _parseIntValue() throws tools.jackson.core.JacksonException- Specified by:
_parseIntValuein classtools.jackson.core.base.ParserBase- Throws:
tools.jackson.core.JacksonException
-
getObjectId
- Overrides:
getObjectIdin classtools.jackson.core.JsonParser- Throws:
tools.jackson.core.JacksonException
-
getTypeId
- Overrides:
getTypeIdin classtools.jackson.core.JsonParser- Throws:
tools.jackson.core.JacksonException
-
_reportMismatchedEndMarker
protected void _reportMismatchedEndMarker(int actCh, char expCh) throws tools.jackson.core.JacksonException - Throws:
tools.jackson.core.JacksonException
-