JsonParser implementation used to expose CSV documents
in form that allows other Jackson functionality to deal
with it.
Implementation is based on a state-machine that pulls information
using CsvDecoder.
| Modifier and Type | Class and Description |
|---|---|
| public static enum | CsvParser.
Enumeration that defines all togglable features for CSV parsers |
| Modifier and Type | Field and Description |
|---|---|
| protected String | |
| protected String | _arrayValue
Contents of the cell, to be split into distinct array values. |
| protected int | _arrayValueStart
Pointer to the first character of the next array value to return. |
| protected byte[] | _binaryValue
We will hold on to decoded binary data, for duration of
current event, so that multiple calls to
|
| protected ByteArrayBuilder | |
| protected boolean | |
| protected boolean | |
| protected int | _columnCount
Number of columns defined by schema. |
| protected int | _columnIndex
Index of the column we are exposing |
| protected String | _currentName
Name of column that we exposed most recently, accessible after
|
| protected String | _currentValue
String value for the current column, if accessed. |
| protected int | |
| protected final IOContext | |
| protected String | |
| protected ObjectCodec | _objectCodec
Codec used for data binding when (if) requested. |
| protected JsonReadContext | _parsingContext
Information about parser context, context in which the next token is to be parsed (root, array, object). |
| protected final CsvDecoder | _reader
Thing that actually reads the CSV content |
| protected CsvSchema | _schema
Definition of columns being read. |
| protected int | _state
Current logical state of the parser; one of |
| protected final TextBuffer | _textBuffer
Buffer that contains contents of all values after processing of doubled-quotes, escaped characters. |
| private static final CsvSchema | |
| private static final int | |
| protected static final int | STATE_DOC_END
State in which end marker is returned; either
null (if no array wrapping), or
|
| protected static final int | STATE_DOC_START
Initial state before anything is read from document. |
| protected static final int | STATE_IN_ARRAY
State in which a column value has been determined to be of an array type, and will need to be split into multiple values. |
| protected static final int | STATE_MISSING_NAME
State in which we should expose name token for a "missing column"
(for which placeholder `null` value is to be added as well);
see |
| protected static final int | STATE_MISSING_VALUE
State in which we should expose `null` value token as a value for
"missing" column;
see |
| protected static final int | STATE_NAMED_VALUE
State in which value matching field name will be returned. |
| protected static final int | STATE_NEXT_ENTRY
State in which next entry will be available, returning
either |
| protected static final int | STATE_RECORD_START
State before logical start of a record, in which next
token to return will be |
| protected static final int | STATE_SKIP_EXTRA_COLUMNS
State in which we have encountered more column values than there should be, and need to basically skip extra values if callers tries to advance parser state. |
| protected static final int | STATE_UNNAMED_VALUE
State in which "unnamed" value (entry in an array) will be returned, if one available; otherwise end-array is returned. |
| protected static final JacksonFeatureSet | STREAM_READ_CAPABILITIES
CSV is slightly different from defaults, having essentially untyped scalars except if indicated by schema |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public ByteArrayBuilder | |
| protected JsonToken | |
| protected void | _handleEOF()
Implements abstract com. Method sub-classes need to implement for verifying that end-of-content is acceptable at current input position. |
| protected JsonToken | |
| protected JsonToken | _handleMissingColumns()
Helper method called when end of row occurs before finding values for all schema-specified columns. |
| protected JsonToken | |
| protected JsonToken | |
| protected JsonToken | |
| protected JsonToken | |
| protected final JsonToken | _handleObjectRowEnd()
Helper method called to handle details of state update when end of logical record occurs. |
| protected JsonToken | |
| protected JsonToken | _handleStartDoc()
Method called to handle details of initializing things to return the very first token. |
| protected JsonToken | |
| protected boolean | _isNullValue(String value)
Helper method called to check whether specified String value should be considered "null" value, if so configured. |
| protected void | |
| public <T> T | _reportCsvMappingError(String msg, Object... args)
Method called when there is a problem related to mapping data (compared to a low-level generation); if so, should be surfaced as |
| public void | |
| public void | |
| protected final JsonToken | |
| protected void | |
| public boolean | canReadObjectId()
Overrides com. Introspection method that may be called to see if the underlying data format supports some kind of Object Ids natively (many do not; for example, JSON doesn't). |
| public boolean | canReadTypeId()
Overrides com. 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 boolean | canUseSchema(FormatSchema
Schema to check schema)Overrides com. Method that can be used to verify that given schema can be used with
this parser (using |
| public void | close()
Implements abstract com. Implements java. 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
|
| public JsonParser | |
| public JsonLocation | currentLocation()
Overrides com. Method that returns location of the last processed input unit (character or byte) from the input; usually for error reporting purposes. |
| public String | currentName()
Overrides com. Method that can be called to get the name associated with
the current token: for |
| public JsonLocation | currentTokenLocation()
Overrides com. Method that return the starting location of the current (most recently returned) token; that is, the position of the first input unit (character or byte) from input that starts the current token. |
| public JsonParser | |
| public JsonParser | |
| public BigInteger | getBigIntegerValue()
Implements abstract com. Numeric accessor that can be called when the current
token is of type |
| public byte[] | getBinaryValue(Base64Variant
Expected variant of base64 encoded
content (see variant)Base64Variants for definitions
of "standard" variants).Implements abstract com. 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 ObjectCodec | getCodec()
Implements abstract com. Accessor for |
| public JsonLocation | getCurrentLocation()
Implements abstract com.
Deprecated
Deprecated alias for |
| public String | getCurrentName()
Implements abstract com.
Deprecated
Deprecated alias of |
| public BigDecimal | getDecimalValue()
Implements abstract com. Numeric accessor that can be called when the current
token is of type |
| public double | getDoubleValue()
Implements abstract com. Numeric accessor that can be called when the current
token is of type |
| public Object | getEmbeddedObject()
Overrides com. Accessor that can be called if (and only if) the current token
is |
| public float | getFloatValue()
Implements abstract com. Numeric accessor that can be called when the current
token is of type |
| public int | getFormatFeatures()
Overrides com. Bulk access method for getting state of all |
| public Object | getInputSource()
Overrides com. Method that can be used to get access to object that is used
to access input being parsed; this is usually either
|
| public int | getIntValue()
Implements abstract com. Numeric accessor that can be called when the current
token is of type |
| public long | getLongValue()
Implements abstract com. Numeric accessor that can be called when the current
token is of type |
| public JsonParser. | getNumberType()
Implements abstract com. If current token is of type
|
| public JsonParser. | getNumberTypeFP()
Overrides com. If current token is of type
|
| public Number | getNumberValue()
Implements abstract com. Generic number value accessor method that will work for all kinds of numeric values. |
| public Number | getNumberValueExact()
Overrides com. Method similar to |
| public JsonStreamContext | getParsingContext()
Implements abstract com. 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 JacksonFeatureSet | getReadCapabilities()
Overrides com. Accessor for getting metadata on capabilities of this parser, based on underlying data format being read (directly or indirectly). |
| public CsvSchema | getSchema()
Overrides com. Accessor for getting active schema definition: it may be "empty" (no column definitions), but will never be null since it defaults to an empty schema (and default configuration) |
| public String | getText()
Implements abstract com. Method for accessing textual representation of the current token;
if no current token (before first call to |
| public int | getText(Writer
Writer to write textual content to w)Overrides com. Method to read the textual representation of the current token in chunks and pass it to the given Writer. |
| public char[] | getTextCharacters()
Implements abstract com. Method similar to |
| public int | getTextLength()
Implements abstract com. Accessor used with |
| public int | getTextOffset()
Implements abstract com. Accessor used with |
| public JsonLocation | getTokenLocation()
Implements abstract com.
Deprecated
Deprecated alias for |
| public boolean | hasTextCharacters()
Implements abstract com. Method that can be used to determine whether calling of
|
| public boolean | isClosed()
Implements abstract com. Method that can be called to determine whether this parser is closed or not. |
| public boolean | |
| public boolean | Returns: Whether the token can be read asJsonToken.VALUE_NUMBER_INT
(with possible coercion)Overrides com. Similar to |
| public boolean | isExpectedStartArrayToken()
Overrides com. We need to override this method to support coercion from basic String value into array, in cases where schema does not specify actual type. |
| public boolean | nextFieldName(SerializableString
Property name to compare next token to (if next token is
str)JsonToken.FIELD_NAME)Overrides com. Method that fetches next token (as if calling |
| public String | nextFieldName()
Overrides com. Method that fetches next token (as if calling |
| public String | nextTextValue()
Overrides com. Method that fetches next token (as if calling |
| public JsonToken | nextToken()
Implements abstract com. Main iteration method, which will advance stream enough to determine type of the next token, if any. |
| public void | overrideCurrentName(String
Name to use as the current name; may be null. name)Implements abstract com. Method that can be used to change what is considered to be the current (field) name. |
| public JsonParser | overrideFormatFeatures(int
Bit mask of set/clear state for features to change values, int Bit mask of features to change mask)Overrides com. Bulk set method for (re)setting states of |
| public int | releaseBuffered(Writer
Writer to which buffered but unprocessed content is written to out)Overrides com. Method that can be called to push back any content that has been read but not consumed by the parser. |
| public boolean | requiresCustomCodec()
Overrides com. Method that can be called to determine if a custom
|
| public void | setCodec(ObjectCodec
Codec to assign, if any; c)null if noneImplements abstract com. Setter that allows defining |
| public void | setSchema(final FormatSchema
Schema to use schema)Overrides com. Method to call to make this parser use specified schema. |
| public Version | version()
Implements abstract com. Implements com. Accessor for getting version of the core package, given a parser instance. |