JsonParser implementation for decoding Avro content and
exposing at as a stream of JsonTokens, to be used
for data binding.
| Modifier and Type | Field and Description |
|---|---|
| protected AvroReadContext | |
| protected int | |
| protected AvroSchema | |
| protected SimpleStreamReadContext | _streamReadContext
Information about parser context, context in which the next token is to be parsed (root, array, object). |
| protected static final JacksonFeatureSet |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| protected abstract void | _closeInput()
Implements abstract tools. Abstract method for sub-classes to implement; to be called by
|
| protected abstract void | |
| protected int | |
| protected void | _parseNumericValue(int expType)
Implements abstract tools. Method that will parse actual numeric value out of a syntactically valid number value. |
| public void | assignCurrentValue(Object v)
Overrides tools. Helper method, usually equivalent to:
|
| public boolean | canReadTypeId()
Overrides tools. Introspection method that may be called to see if the underlying data format supports some kind of Type Ids natively (many do not; for example, JSON doesn't). |
| public JsonParser | configure(AvroReadFeature f, boolean state)
Method for enabling or disabling specified Avro feature
(check |
| public TokenStreamLocation | currentLocation()
Implements abstract tools. Method that returns location of the last processed character; usually for error reporting purposes. |
| public String | currentName()
Implements abstract tools. Method that can be called to get the name associated with
the current token: for |
| public TokenStreamLocation | currentTokenLocation()
Implements abstract tools. Method that return the starting location of the current token; that is, position of the first character from input that starts the current token. |
| public Object | currentValue()
Overrides tools. Helper method, usually equivalent to:
Note that "current value" is NOT populated (or used) by Streaming parser; it is only used by higher-level data-binding functionality. |
| public JsonParser | disable(AvroReadFeature f)
Method for disabling specified Avro feature
(check |
| public JsonParser | enable(AvroReadFeature f)
Method for enabling specified Avro feature
(check |
| public byte[] | getBinaryValue(Base64Variant variant)
Overrides tools. Method that can be used to read (and consume -- results may not be accessible using other methods after the call) base64-encoded binary data included in the current textual JSON value. |
| public Object | getEmbeddedObject()
Overrides tools. Accessor that can be called if (and only if) the current token
is |
| public AvroSchema | getSchema()
Overrides tools. Method for accessing Schema that this parser uses, if any. |
| public abstract String | getString()
Implements abstract tools. Method for accessing textual representation of the current token;
if no current token (before first call to |
| public abstract int | getString(Writer writer)
Overrides tools. Method to read the textual representation of the current token in chunks and pass it to the given Writer. |
| public char[] | getStringCharacters()
Implements abstract tools. Method similar to |
| public int | getStringLength()
Implements abstract tools. Accessor used with |
| public int | getStringOffset()
Implements abstract tools. Accessor used with |
| public Object | getTypeId()
Overrides tools. Method that can be called to check whether current token (one that was just read) has an associated type id, and if so, return it. |
| public abstract boolean | hasStringCharacters()
Overrides tools. Method that can be used to determine whether calling of
|
| public boolean | |
| protected void | |
| public JacksonFeatureSet | streamReadCapabilities()
Overrides tools. Accessor for getting metadata on capabilities of this parser, based on underlying data format being read (directly or indirectly). |
| public TokenStreamContext | streamReadContext()
Implements abstract tools. Method that can be used to access current parsing context reader is in. There are 3 different types: root, array and object contexts, with slightly different available information. |
| public abstract Object | streamReadInputSource()
Implements abstract tools. Method that can be used to get access to object that is used
to access input being parsed; this is usually either
|
| public Version | version()
Implements abstract tools. Implements tools. Accessor for getting version of the core package, given a parser instance. |
| _avroContext | back to summary |
|---|---|
| protected AvroReadContext _avroContext | |
| _formatFeatures | back to summary |
|---|---|
| protected int _formatFeatures | |
| _rootSchema | back to summary |
|---|---|
| protected AvroSchema _rootSchema | |
| _streamReadContext | back to summary |
|---|---|
| protected SimpleStreamReadContext _streamReadContext Information about parser context, context in which the next token is to be parsed (root, array, object). | |
| AVRO_READ_CAPABILITIES | back to summary |
|---|---|
| protected static final JacksonFeatureSet<StreamReadCapability> AVRO_READ_CAPABILITIES | |
| AvroParser | back to summary |
|---|---|
| protected AvroParser(ObjectReadContext readCtxt, IOContext ioCtxt, int parserFeatures, int avroFeatures) | |
| _closeInput | back to summary |
|---|---|
| protected abstract void _closeInput() throws IOException Implements abstract tools. Doc from tools. Abstract method for sub-classes to implement; to be called by
| |
| _initSchema | back to summary |
|---|---|
| protected abstract void _initSchema(AvroSchema schema) throws JacksonException | |
| _parseIntValue | back to summary |
|---|---|
| protected int _parseIntValue() throws JacksonException Implements abstract tools.
| |
| _parseNumericValue | back to summary |
|---|---|
| protected void _parseNumericValue(int expType) throws JacksonException Implements abstract tools. Doc from tools. Method that will parse actual numeric value out of a syntactically valid number value. Type it will parse into depends on whether it is a floating point number, as well as its magnitude: smallest legal type (of ones available) is used for efficiency.
| |
| assignCurrentValue | back to summary |
|---|---|
| public void assignCurrentValue(Object v) Overrides tools. Doc from tools. Helper method, usually equivalent to:
| |
| canReadTypeId | back to summary |
|---|---|
| public boolean canReadTypeId() Overrides tools. Doc from tools. Introspection method that may be called to see if the underlying data format supports some kind of Type Ids natively (many do not; for example, JSON doesn't). Default implementation returns true; overridden by data formats that do support native Type Ids. Caller is expected to either use a non-native notation (explicit property or such), or fail, in case it cannot use native type ids.
| |
| configure | back to summary |
|---|---|
| public JsonParser configure(AvroReadFeature f, boolean state) Method for enabling or disabling specified Avro feature
(check | |
| currentLocation | back to summary |
|---|---|
| public TokenStreamLocation currentLocation() Implements abstract tools. Doc from tools. Method that returns location of the last processed character; usually for error reporting purposes.
Note that the location is not guaranteed to be accurate (although most
implementation will try their best): some implementations may only
report specific boundary locations (start or end locations of tokens)
and others only return
| |
| currentName | back to summary |
|---|---|
| public String currentName() throws JacksonException Implements abstract tools. Doc from tools. Method that can be called to get the name associated with
the current token: for
| |
| currentTokenLocation | back to summary |
|---|---|
| public TokenStreamLocation currentTokenLocation() Implements abstract tools. Doc from tools. Method that return the starting location of the current token; that is, position of the first character from input that starts the current token.
Note that the location is not guaranteed to be accurate (although most
implementation will try their best): some implementations may only
return
| |
| currentValue | back to summary |
|---|---|
| public Object currentValue() Overrides tools. Doc from tools. Helper method, usually equivalent to:
Note that "current value" is NOT populated (or used) by Streaming parser; it is only used by higher-level data-binding functionality. The reason it is included here is that it can be stored and accessed hierarchically, and gets passed through data-binding.
| |
| disable | back to summary |
|---|---|
| public JsonParser disable(AvroReadFeature f) Method for disabling specified Avro feature
(check | |
| enable | back to summary |
|---|---|
| public JsonParser enable(AvroReadFeature f) Method for enabling specified Avro feature
(check | |
| getBinaryValue | back to summary |
|---|---|
| public byte[] getBinaryValue(Base64Variant variant) throws JacksonException Overrides tools. Doc from tools. Method that can be used to read (and consume -- results
may not be accessible using other methods after the call)
base64-encoded binary data
included in the current textual JSON value.
It works similar to getting String value via Note that non-decoded textual contents of the current token are not guaranteed to be accessible after this method is called. Current implementation, for example, clears up textual content during decoding. Decoded binary content, however, will be retained until parser is advanced to the next event.
| |
| getEmbeddedObject | back to summary |
|---|---|
| public Object getEmbeddedObject() throws JacksonException Overrides tools. Doc from tools. Accessor that can be called if (and only if) the current token
is Note only some specialized parser implementations support
embedding of objects (usually ones that are facades on top
of non-streaming sources, such as object trees). One exception
is access to binary content (whether via base64 encoding or not)
which typically is accessible using this method, as well as
| |
| getSchema | back to summary |
|---|---|
| public AvroSchema getSchema() Overrides tools. Doc from tools. Method for accessing Schema that this parser uses, if any. Default implementation returns null.
| |
| getString | back to summary |
|---|---|
| public abstract String getString() throws JacksonException Implements abstract tools. Doc from tools. Method for accessing textual representation of the current token;
if no current token (before first call to
| |
| getString | back to summary |
|---|---|
| public abstract int getString(Writer writer) throws JacksonException Overrides tools. Doc from tools. Method to read the textual representation of the current token in chunks and pass it to the given Writer. Functionally same as calling: writer.write(parser.getString());but should typically be more efficient as longer content does need to be combined into a single String to return, and write
can occur directly from intermediate buffers Jackson uses.Note String value will still be buffered (usually
using Note In Jackson 2.x this method was called
| |
| getStringCharacters | back to summary |
|---|---|
| public char[] getStringCharacters() throws JacksonException Implements abstract tools. Doc from tools. Method similar to
Note that caller MUST NOT modify the returned character array in any way -- doing so may corrupt current parser state and render parser instance useless.
The only reason to call this method (over
| |
| getStringLength | back to summary |
|---|---|
| public int getStringLength() throws JacksonException Implements abstract tools. Doc from tools. Accessor used with
| |
| getStringOffset | back to summary |
|---|---|
| public int getStringOffset() throws JacksonException Implements abstract tools. Doc from tools. Accessor used with
| |
| getTypeId | back to summary |
|---|---|
| public Object getTypeId() throws JacksonException Overrides tools. Doc from tools. Method that can be called to check whether current token
(one that was just read) has an associated type id, and if
so, return it.
Note that while typically caller should check with Default implementation will simply return null.
| |
| hasStringCharacters | back to summary |
|---|---|
| public abstract boolean hasStringCharacters() Overrides tools. Doc from tools. Method that can be used to determine whether calling of
| |
| isEnabled | back to summary |
|---|---|
| public boolean isEnabled(AvroReadFeature f) Method for checking whether specified Avro | |
| setSchema | back to summary |
|---|---|
| protected void setSchema(AvroSchema schema) throws JacksonException | |
| streamReadCapabilities | back to summary |
|---|---|
| public JacksonFeatureSet Overrides tools. Doc from tools. Accessor for getting metadata on capabilities of this parser, based on underlying data format being read (directly or indirectly).
| |
| streamReadContext | back to summary |
|---|---|
| public TokenStreamContext streamReadContext() Implements abstract tools. Doc from tools. Method that can be used to access current parsing context reader is in. There are 3 different types: root, array and object contexts, with slightly different available information. Contexts are hierarchically nested, and can be used for example for figuring out part of the input document that correspond to specific array or object (for highlighting purposes, or error reporting). Contexts can also be used for simple xpath-like matching of input, if so desired. Note method was called
| |
| streamReadInputSource | back to summary |
|---|---|
| public abstract Object streamReadInputSource() Implements abstract tools. Doc from tools. Method that can be used to get access to object that is used
to access input being parsed; this is usually either
In general use of this accessor should be considered as "last effort", i.e. only used if no other mechanism is applicable. Note was named
| |
| version | back to summary |
|---|---|
| public Version version() Implements abstract tools. Implements tools. Doc from tools. Accessor for getting version of the core package, given a parser instance. Left for sub-classes to implement.
| |