|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.fasterxml.jackson.core.JsonParser
com.fasterxml.jackson.core.base.ParserMinimalBase
com.fasterxml.jackson.dataformat.csv.CsvParser
public class CsvParser
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 CsvReader.
| Nested Class Summary | |
|---|---|
static class |
CsvParser.Feature
Enumeration that defines all togglable features for CSV parsers |
| Nested classes/interfaces inherited from class com.fasterxml.jackson.core.JsonParser |
|---|
JsonParser.NumberType |
| Field Summary | |
|---|---|
protected byte[] |
_binaryValue
We will hold on to decoded binary data, for duration of current event, so that multiple calls to getBinaryValue(com.fasterxml.jackson.core.Base64Variant) will not need to decode data more
than once. |
protected ByteArrayBuilder |
_byteArrayBuilder
|
protected int |
_columnCount
Number of columns defined by schema. |
protected int |
_columnIndex
Index of the column we are exposing |
protected int |
_csvFeatures
|
protected String |
_currentName
Name of column that we exposed most recently, accessible after JsonToken.FIELD_NAME as well as value tokens immediately
following field name. |
protected String |
_currentValue
String value for the current column, if accessed. |
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 CsvReader |
_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 STATE_
constants. |
protected TextBuffer |
_textBuffer
Buffer that contains contents of all values after processing of doubled-quotes, escaped characters. |
protected static int |
STATE_DOC_END
State in which end marker is returned; either null (if no array wrapping), or JsonToken.END_ARRAY for wrapping. |
protected static int |
STATE_DOC_START
Initial state before anything is read from document. |
protected static int |
STATE_NAMED_VALUE
State in which value matching field name will be returned. |
protected static int |
STATE_NEXT_ENTRY
State in which next entry will be available, returning either JsonToken.FIELD_NAME or value
(depending on whether entries are expressed as
Objects or just Arrays); or
matching close marker. |
protected static int |
STATE_RECORD_START
State before logical start of a record, in which next token to return will be JsonToken.START_OBJECT
(or if no Schema is provided, JsonToken.START_ARRAY). |
protected static int |
STATE_UNNAMED_VALUE
State in which "unnamed" value (entry in an array) will be returned, if one available; otherwise end-array is returned. |
| Fields inherited from class com.fasterxml.jackson.core.base.ParserMinimalBase |
|---|
_currToken, _lastClearedToken, INT_APOSTROPHE, INT_ASTERISK, INT_b, INT_BACKSLASH, INT_COLON, INT_COMMA, INT_CR, INT_f, INT_LBRACKET, INT_LCURLY, INT_LF, INT_n, INT_QUOTE, INT_r, INT_RBRACKET, INT_RCURLY, INT_SLASH, INT_SPACE, INT_t, INT_TAB, INT_u |
| Fields inherited from class com.fasterxml.jackson.core.JsonParser |
|---|
_features |
| Constructor Summary | |
|---|---|
CsvParser(IOContext ctxt,
BufferRecycler br,
int parserFeatures,
int csvFeatures,
ObjectCodec codec,
Reader reader)
|
|
| Methods inherited from class com.fasterxml.jackson.core.base.ParserMinimalBase |
|---|
_constructError, _decodeBase64, _getCharDesc, _handleUnrecognizedCharacterEscape, _reportBase64EOF, _reportError, _reportInvalidBase64, _reportInvalidEOF, _reportInvalidEOF, _reportInvalidEOFInValue, _reportUnexpectedChar, _throwInternal, _throwInvalidSpace, _throwUnquotedSpace, _wrapError, clearCurrentToken, getCurrentToken, getLastClearedToken, getValueAsBoolean, getValueAsDouble, getValueAsInt, getValueAsLong, hasCurrentToken, nextValue, skipChildren |
| Methods inherited from class com.fasterxml.jackson.core.JsonParser |
|---|
_constructError, configure, disable, enable, getBinaryValue, getBooleanValue, getByteValue, getShortValue, getValueAsBoolean, getValueAsDouble, getValueAsInt, getValueAsLong, isEnabled, isExpectedStartArrayToken, nextBooleanValue, nextFieldName, nextIntValue, nextLongValue, nextTextValue, readValueAs, readValueAs, readValueAsTree, readValuesAs, readValuesAs, releaseBuffered |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final int STATE_DOC_START
protected static final int STATE_RECORD_START
JsonToken.START_OBJECT
(or if no Schema is provided, JsonToken.START_ARRAY).
protected static final int STATE_NEXT_ENTRY
JsonToken.FIELD_NAME or value
(depending on whether entries are expressed as
Objects or just Arrays); or
matching close marker.
protected static final int STATE_NAMED_VALUE
protected static final int STATE_UNNAMED_VALUE
protected static final int STATE_DOC_END
JsonToken.END_ARRAY for wrapping.
This step will loop, returning series of nulls
if nextToken() is called multiple times.
protected ObjectCodec _objectCodec
protected int _csvFeatures
protected CsvSchema _schema
protected int _columnCount
protected JsonReadContext _parsingContext
protected String _currentName
JsonToken.FIELD_NAME as well as value tokens immediately
following field name.
protected String _currentValue
protected int _columnIndex
protected int _state
STATE_
constants.
protected byte[] _binaryValue
getBinaryValue(com.fasterxml.jackson.core.Base64Variant) will not need to decode data more
than once.
protected final CsvReader _reader
protected final TextBuffer _textBuffer
protected ByteArrayBuilder _byteArrayBuilder
| Constructor Detail |
|---|
public CsvParser(IOContext ctxt,
BufferRecycler br,
int parserFeatures,
int csvFeatures,
ObjectCodec codec,
Reader reader)
| Method Detail |
|---|
public Version version()
version in interface Versionedversion in class ParserMinimalBasepublic ObjectCodec getCodec()
getCodec in class JsonParserpublic void setCodec(ObjectCodec c)
setCodec in class JsonParserpublic boolean canUseSchema(FormatSchema schema)
canUseSchema in class JsonParserpublic void setSchema(FormatSchema schema)
setSchema in class JsonParser
public int releaseBuffered(Writer out)
throws IOException
releaseBuffered in class JsonParserIOExceptionpublic boolean isClosed()
isClosed in class ParserMinimalBase
public void close()
throws IOException
close in interface Closeableclose in class ParserMinimalBaseIOExceptionpublic JsonParser enable(CsvParser.Feature f)
CsvParser.Feature for list of features)
public JsonParser disable(CsvParser.Feature f)
CsvParser.Feature for list of features)
public JsonParser configure(CsvParser.Feature f,
boolean state)
CsvParser.Feature for list of features)
public boolean isEnabled(CsvParser.Feature f)
CsvParser.Feature
is enabled.
public CsvSchema getSchema()
getSchema in class JsonParserpublic JsonStreamContext getParsingContext()
getParsingContext in class ParserMinimalBasepublic JsonLocation getTokenLocation()
getTokenLocation in class JsonParserpublic JsonLocation getCurrentLocation()
getCurrentLocation in class JsonParserpublic Object getInputSource()
getInputSource in class JsonParser
public String getCurrentName()
throws IOException,
JsonParseException
getCurrentName in class ParserMinimalBaseIOException
JsonParseExceptionpublic void overrideCurrentName(String name)
overrideCurrentName in class ParserMinimalBase
public JsonToken nextToken()
throws IOException,
JsonParseException
nextToken in class ParserMinimalBaseIOException
JsonParseException
protected JsonToken _handleStartDoc()
throws IOException,
JsonParseException
IOException
JsonParseException
protected JsonToken _handleRecordStart()
throws IOException,
JsonParseException
IOException
JsonParseException
protected JsonToken _handleNextEntry()
throws IOException,
JsonParseException
IOException
JsonParseException
protected JsonToken _handleNamedValue()
throws IOException,
JsonParseException
IOException
JsonParseException
protected JsonToken _handleUnnamedValue()
throws IOException,
JsonParseException
IOException
JsonParseException
protected void _readHeaderLine()
throws IOException,
JsonParseException
IOException
JsonParseExceptionpublic boolean hasTextCharacters()
hasTextCharacters in class ParserMinimalBase
public String getText()
throws IOException,
JsonParseException
getText in class ParserMinimalBaseIOException
JsonParseException
public char[] getTextCharacters()
throws IOException,
JsonParseException
getTextCharacters in class ParserMinimalBaseIOException
JsonParseException
public int getTextLength()
throws IOException,
JsonParseException
getTextLength in class ParserMinimalBaseIOException
JsonParseException
public int getTextOffset()
throws IOException,
JsonParseException
getTextOffset in class ParserMinimalBaseIOException
JsonParseException
public Object getEmbeddedObject()
throws IOException,
JsonParseException
getEmbeddedObject in class JsonParserIOException
JsonParseException
public byte[] getBinaryValue(Base64Variant variant)
throws IOException,
JsonParseException
getBinaryValue in class ParserMinimalBaseIOException
JsonParseException
public JsonParser.NumberType getNumberType()
throws IOException,
JsonParseException
getNumberType in class JsonParserIOException
JsonParseException
public Number getNumberValue()
throws IOException,
JsonParseException
getNumberValue in class JsonParserIOException
JsonParseException
public int getIntValue()
throws IOException,
JsonParseException
getIntValue in class JsonParserIOException
JsonParseException
public long getLongValue()
throws IOException,
JsonParseException
getLongValue in class JsonParserIOException
JsonParseException
public BigInteger getBigIntegerValue()
throws IOException,
JsonParseException
getBigIntegerValue in class JsonParserIOException
JsonParseException
public float getFloatValue()
throws IOException,
JsonParseException
getFloatValue in class JsonParserIOException
JsonParseException
public double getDoubleValue()
throws IOException,
JsonParseException
getDoubleValue in class JsonParserIOException
JsonParseException
public BigDecimal getDecimalValue()
throws IOException,
JsonParseException
getDecimalValue in class JsonParserIOException
JsonParseException
protected void _handleEOF()
throws JsonParseException
_handleEOF in class ParserMinimalBaseJsonParseException
public void _reportCsvError(String msg)
throws JsonParseException
JsonParseException
public void _reportUnexpectedCsvChar(int ch,
String msg)
throws JsonParseException
JsonParseExceptionpublic ByteArrayBuilder _getByteArrayBuilder()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||