Top Description Fields Constructors Methods
tools.jackson.core.base

public abstract Class ParserMinimalBase

extends JsonParser
Class Inheritance
Known Direct Subclasses
tools.jackson.core.base.ParserBase
Imports
java.io.IOException, .Writer, java.math.BigDecimal, .BigInteger, tools.jackson.core.*, tools.jackson.core.exc.InputCoercionException, .JacksonIOException, .StreamConstraintsException, .StreamReadException, .UnexpectedEndOfInputException, tools.jackson.core.io.IOContext, .NumberInput, tools.jackson.core.sym.PropertyNameMatcher, tools.jackson.core.type.ResolvedType, .TypeReference, tools.jackson.core.util.ByteArrayBuilder, .JacksonFeatureSet, .VersionUtil

Intermediate base class used by all Jackson JsonParser implementations, but does not add any additional fields that depend on particular method of obtaining input.

Note that 'minimal' here mostly refers to minimal number of fields (size) and functionality that is specific to certain types of parser implementations; but not necessarily to number of methods.

Field Summary

Modifier and TypeField and Description
protected boolean
_closed

Flag that indicates whether parser is closed or not.

protected JsonToken
_currToken

Last token retrieved via nextToken, if any.

protected final IOContext
_ioContext

I/O context for this reader.

protected JsonToken
_lastClearedToken

Last cleared token, if any: that is, value that was in effect when clearCurrentToken was called.

protected final ObjectReadContext
_objectReadContext

Context object provided by higher level functionality like databinding for two reasons: passing configuration information during construction, and to allow calling of some databind operations via parser instance.

protected final StreamReadConstraints
_streamReadConstraints

Constraints to use for this parser.

protected final int
_streamReadFeatures

Bit flag composed of bits that indicate which tools.jackson.core.StreamReadFeatures are enabled.

protected long
_tokenCount

Current count of tokens, if tracked (see _trackMaxTokenCount)

protected final boolean
_trackMaxTokenCount

Whether or not to track the token count due a StreamReadConstraints maxTokenCount > 0.

protected static final BigDecimal
protected static final BigDecimal
protected static final BigDecimal
protected static final BigDecimal
protected static final BigInteger
protected static final BigInteger
protected static final BigInteger
protected static final BigInteger
protected static final char
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final double
protected static final long
protected static final double
protected static final int
protected static final int
protected static final double
protected static final long
protected static final double
protected static final int
protected static final byte[]
protected static final int[]
protected static final int
protected static final int
protected static final int
protected static final int
NR_FLOAT

Note

Not used by JSON implementation but used by many of binary codecs

protected static final int
protected static final int
protected static final int
protected static final int
Inherited from tools.jackson.core.JsonParser:
DEFAULT_READ_CAPABILITIES

Constructor Summary

AccessConstructor and Description
protected
ParserMinimalBase(ObjectReadContext
Context for databinding
readCtxt
,
IOContext
Context for I/O handling, buffering
ioCtxt
,
int
Bit set of StreamReadFeatures.
streamReadFeatures
)

Main constructor for sub-classes to use

protected
ParserMinimalBase(ObjectReadContext
Context for databinding
readCtxt
)

Alternate constructors for cases where there is no real IOContext in use; typically for abstractions that operate over non-streaming/incremental sources (such as jackson-databind TokenBuffer).

Method Summary

Modifier and TypeMethod and Description
protected abstract void
_closeInput()

Abstract method for sub-classes to implement; to be called by close() implementation here.

protected InputCoercionException
_constructInputCoercion(String msg, JsonToken inputType, Class<?> targetType)

protected InputCoercionException
_constructNotNumericType(JsonToken actualToken, int expNumericType)

protected TokenStreamLocation

Returns:

Same as currentLocation() except offset by -1
_currentLocationMinusOne
()

Factory method used to provide location for cases where we must read and consume a single "wrong" character (to possibly allow error recovery), but need to report accurate location for that character: if so, the current location is past location we want, and location we want will be "one location earlier".

protected void
_decodeBase64(String
String to decode
str
,
ByteArrayBuilder
Builder used to buffer binary content decoded
builder
,
Base64Variant
Base64 variant expected in content
b64variant
)

Helper method that can be used for base64 decoding in cases where encoded content has already been read as a String.

protected static final String
_getCharDesc(int ch)

protected abstract void
_handleEOF()

Method sub-classes need to implement to check whether end-of-content is allowed at the current decoding position: formats often want to verify the all start/end token pairs match, for example.

protected boolean

Returns:

True if given value contains "null equivalent" String value (for content this parser handles).
_hasTextualNull
(String
String value to check
value
)

Helper method used to determine whether we are currently pointing to a String value of "null" (NOT a null token); and, if so, that parser is to recognize and return it similar to if it was real null token.

protected String
protected String
protected final JsonToken
protected abstract void
_releaseBuffers()

Method called to release internal buffers owned by the base reader.

protected <T> T
_reportBadInputStream(int readLen)

protected <T> T
_reportBadReader(int readLen)

protected <T> T
protected <T> T
protected <T> T
_reportError(String msg, Object arg1, Object arg2)

protected <T> T
_reportError(String msg, Object arg1, Object arg2, Object arg3)

protected <T> T
protected <T> T
protected <T> T
protected <
Nominal type parameter for bogus return value
T
>
T

Returns:

Nothing: never returns; declared so caller can use fake return to keep compiler happy
_reportInvalidNumber
(String
Base exception message to use
msg
)

Method called to throw an exception for input token that looks like a number based on first character(s), but is not valid according to rules of format.

protected <T> T
protected <T> T
protected void
_reportOverflowByte(String numDesc, JsonToken inputType)

protected void
_reportOverflowInt()

Method called to throw an exception for integral (not floating point) input token with value outside of Java signed 32-bit range when requested as int.

protected void
protected void
_reportOverflowInt(String numDesc, JsonToken inputType)

protected void
_reportOverflowLong()

Method called to throw an exception for integral (not floating point) input token with value outside of Java signed 64-bit range when requested as long.

protected void
protected void
_reportOverflowLong(String numDesc, JsonToken inputType)

protected void
protected <T> T
_reportUnexpectedChar(int ch, String comment)

protected <T> T
protected <T> T
protected final JsonToken
_updateToken(final JsonToken token)

protected final JsonToken
protected final JsonToken
protected JacksonException
public void
clearCurrentToken()

Implements abstract tools.jackson.core.JsonParser.clearCurrentToken.

Method called to "consume" the current token by effectively removing it so that hasCurrentToken returns false, and currentToken null).

public void
close()

Implements abstract tools.jackson.core.JsonParser.close.

Implements java.io.Closeable.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 StreamReadFeature#AUTO_CLOSE_SOURCE is enabled.

public int
currentNameMatch(PropertyNameMatcher matcher)

Implements abstract tools.jackson.core.JsonParser.currentNameMatch.

Method that verifies that the current token (see currentToken) is JsonToken#PROPERTY_NAME and if so, further match that associated name (see currentName) to one of pre-specified (property) names.

public JsonToken
currentToken()

Implements abstract tools.jackson.core.JsonParser.currentToken.

Accessor to find which token parser currently points to, if any; null will be returned if none.

public long
currentTokenCount()

Implements abstract tools.jackson.core.JsonParser.currentTokenCount.

Get an approximate count of the number of tokens that have been read.

public int
currentTokenId()

Implements abstract tools.jackson.core.JsonParser.currentTokenId.

Method similar to currentToken() but that returns an int instead of JsonToken (enum value).

public void
finishToken()

Implements abstract tools.jackson.core.JsonParser.finishToken.

Method that may be used to force full handling of the current token so that even if lazy processing is enabled, the whole contents are read for possible retrieval.

public boolean
getBooleanValue()

Implements abstract tools.jackson.core.JsonParser.getBooleanValue.

Convenience accessor that can be called when the current token is JsonToken#VALUE_TRUE or JsonToken#VALUE_FALSE, to return matching boolean value.

public byte
getByteValue()

Implements abstract tools.jackson.core.JsonParser.getByteValue.

Numeric accessor that can be called when the current token is of type JsonToken#VALUE_NUMBER_INT and it can be expressed as a value of Java byte primitive type.

public Object
getEmbeddedObject()

Implements abstract tools.jackson.core.JsonParser.getEmbeddedObject.

Accessor that can be called if (and only if) the current token is JsonToken#VALUE_EMBEDDED_OBJECT.

public JsonToken
getLastClearedToken()

Implements abstract tools.jackson.core.JsonParser.getLastClearedToken.

Method that can be called to get the last token that was cleared using clearCurrentToken.

public JsonParser.NumberTypeFP
getNumberTypeFP()

Implements abstract tools.jackson.core.JsonParser.getNumberTypeFP.

If current token is of type JsonToken#VALUE_NUMBER_FLOAT, returns one of NumberTypeFP constants; otherwise returns NumberTypeFP#UNKNOWN.

public Object
getNumberValueDeferred()

Implements abstract tools.jackson.core.JsonParser.getNumberValueDeferred.

Method similar to getNumberValue but that returns either same Number value as getNumberValue() (if already decoded), or String representation of as-of-yet undecoded number.

public Number
getNumberValueExact()

Implements abstract tools.jackson.core.JsonParser.getNumberValueExact.

Method similar to getNumberValue with the difference that for floating-point numbers value returned may be BigDecimal if the underlying format does not store floating-point numbers using native representation: for example, textual formats represent numbers as Strings (which are 10-based), and conversion to java.lang.Double is potentially lossy operation.

public short
getShortValue()

Implements abstract tools.jackson.core.JsonParser.getShortValue.

Numeric accessor that can be called when the current token is of type JsonToken#VALUE_NUMBER_INT and it can be expressed as a value of Java short primitive type.

public int
getString(Writer writer)

Implements abstract tools.jackson.core.JsonParser.getString.

Method to read the textual representation of the current token in chunks and pass it to the given Writer.

public boolean
getValueAsBoolean(boolean defaultValue)

Implements abstract tools.jackson.core.JsonParser.getValueAsBoolean.

Method that will try to convert value of current token to a boolean.

public double
getValueAsDouble(double defaultValue)

Overrides tools.jackson.core.JsonParser.getValueAsDouble.

Method that will try to convert value of current token to a Java double.

public int
getValueAsInt()

Overrides tools.jackson.core.JsonParser.getValueAsInt.

Method that will try to convert value of current token to a Java int value.

public int
getValueAsInt(int defaultValue)

Overrides tools.jackson.core.JsonParser.getValueAsInt.

Method that will try to convert value of current token to a int.

public long
getValueAsLong()

Overrides tools.jackson.core.JsonParser.getValueAsLong.

Method that will try to convert value of current token to a long.

public long
getValueAsLong(long defaultValue)

Overrides tools.jackson.core.JsonParser.getValueAsLong.

Method that will try to convert value of current token to a long.

public String
getValueAsString()

Overrides tools.jackson.core.JsonParser.getValueAsString.

Method that will try to convert value of current token to a java.lang.String.

public String
getValueAsString(String defaultValue)

Implements abstract tools.jackson.core.JsonParser.getValueAsString.

Method that will try to convert value of current token to a java.lang.String.

public boolean
hasCurrentToken()

Implements abstract tools.jackson.core.JsonParser.hasCurrentToken.

Method for checking whether parser currently points to a token (and data for that token is available).

public boolean
hasToken(JsonToken t)

Implements abstract tools.jackson.core.JsonParser.hasToken.

Method that is functionally equivalent to: return currentToken() == t but may be more efficiently implemented.

public boolean
hasTokenId(int id)

Implements abstract tools.jackson.core.JsonParser.hasTokenId.

Method that is functionally equivalent to: return currentTokenId() == id but may be more efficiently implemented.

public boolean
isClosed()

Implements abstract tools.jackson.core.JsonParser.isClosed.

Method that can be called to determine whether this parser is closed or not.

public boolean
isEnabled(StreamReadFeature f)

Implements abstract tools.jackson.core.JsonParser.isEnabled.

Method for checking whether specified StreamReadFeature is enabled.

public boolean
public boolean
isExpectedStartArrayToken()

Implements abstract tools.jackson.core.JsonParser.isExpectedStartArrayToken.

Specialized accessor that can be used to verify that the current token indicates start array (usually meaning that current token is JsonToken#START_ARRAY) when start array is expected.

public boolean
public String
nextName()

Implements abstract tools.jackson.core.JsonParser.nextName.

Method that fetches next token (as if calling nextToken) and verifies whether it is JsonToken#PROPERTY_NAME; if it is, returns same as currentName(), otherwise null.

public boolean
nextName(SerializableString str)

Implements abstract tools.jackson.core.JsonParser.nextName.

Method that fetches next token (as if calling nextToken) and verifies whether it is JsonToken#PROPERTY_NAME with specified name and returns result of that comparison.

public int
nextNameMatch(PropertyNameMatcher matcher)

Implements abstract tools.jackson.core.JsonParser.nextNameMatch.

Method that tries to match next token from stream as JsonToken#PROPERTY_NAME, and if so, further match it to one of pre-specified (field) names.

public JsonToken
nextValue()

Implements abstract tools.jackson.core.JsonParser.nextValue.

Iteration method that will advance stream enough to determine type of the next token that is a value type (including JSON Array and Object start/end markers).

public ObjectReadContext
objectReadContext()

Implements abstract tools.jackson.core.JsonParser.objectReadContext.

Accessor for context object provided by higher level data-binding functionality (or, in some cases, simple placeholder of the same) that allows some level of interaction including ability to trigger deserialization of Object values through generator instance.

public <T> T
readValueAs(Class<T> valueType)

Implements abstract tools.jackson.core.JsonParser.readValueAs.

Method to deserialize stream content into a non-container type (it can be an array type, however): typically a bean, array or a wrapper type (like java.lang.Boolean)

Note

method can only be called if the parser has been constructed with a linkage to ObjectReadContext; this is true if constructed by databinding layer above, or by factory method that takes in context object.

public <T> T
readValueAs(TypeReference<T> valueTypeRef)

Implements abstract tools.jackson.core.JsonParser.readValueAs.

Method to deserialize stream content into a Java type, reference to which is passed as argument.

public <T> T
public <T extends TreeNode> T
readValueAsTree()

Implements abstract tools.jackson.core.JsonParser.readValueAsTree.

Method to deserialize stream content into equivalent "tree model", represented by root TreeNode of resulting model.

public JsonParser
skipChildren()

Implements abstract tools.jackson.core.JsonParser.skipChildren.

Method that will skip all child tokens of an array or object token that the parser currently points to, iff stream points to JsonToken#START_OBJECT or JsonToken#START_ARRAY.

public JacksonFeatureSet<StreamReadCapability>
streamReadCapabilities()

Implements abstract tools.jackson.core.JsonParser.streamReadCapabilities.

Accessor for getting metadata on capabilities of this parser, based on underlying data format being read (directly or indirectly).

public StreamReadConstraints
streamReadConstraints()

Implements abstract tools.jackson.core.JsonParser.streamReadConstraints.

Get the constraints to apply when performing streaming reads.

public int
streamReadFeatures()

Implements abstract tools.jackson.core.JsonParser.streamReadFeatures.

Bulk access method for getting state of all standard StreamReadFeatures.

Inherited from tools.jackson.core.JsonParser:
_constructReadException_constructReadException_constructReadException_constructReadException_constructReadException_constructReadException_reportUnsupportedOperationassignCurrentValuecanParseAsynccanReadObjectIdcanReadTypeIdcurrentLocationcurrentNamecurrentTokenLocationcurrentValuegetBigIntegerValuegetBinaryValuegetBinaryValuegetDecimalValuegetDoubleValuegetFloatValuegetIntValuegetLongValuegetNumberTypegetNumberValuegetObjectIdgetSchemagetStringgetStringCharactersgetStringLengthgetStringOffsetgetTextgetTextCharactersgetTextLengthgetTextOffsetgetTypeIdgetValueAsBooleangetValueAsDoublehasStringCharactersisNaNnextBooleanValuenextIntValuenextLongValuenextStringValuenextTokennonBlockingInputFeederreadBinaryValuereadBinaryValuereleaseBufferedreleaseBufferedstreamReadContextstreamReadInputSourceversion