|
||||||||||
| 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 Smile generators. |
| Nested classes/interfaces inherited from class com.fasterxml.jackson.core.JsonParser |
|---|
com.fasterxml.jackson.core.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 com.fasterxml.jackson.core.util.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 com.fasterxml.jackson.core.ObjectCodec |
_objectCodec
Codec used for data binding when (if) requested. |
protected com.fasterxml.jackson.core.json.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(com.fasterxml.jackson.core.io.IOContext ctxt,
com.fasterxml.jackson.core.util.BufferRecycler br,
int parserFeatures,
int csvFeatures,
com.fasterxml.jackson.core.ObjectCodec codec,
Reader reader)
|
|
| Method Summary | |
|---|---|
com.fasterxml.jackson.core.util.ByteArrayBuilder |
_getByteArrayBuilder()
|
protected void |
_handleEOF()
|
protected com.fasterxml.jackson.core.JsonToken |
_handleNamedValue()
|
protected com.fasterxml.jackson.core.JsonToken |
_handleNextEntry()
|
protected com.fasterxml.jackson.core.JsonToken |
_handleRecordStart()
|
protected com.fasterxml.jackson.core.JsonToken |
_handleStartDoc()
Method called to handle details of initializing things to return the very first token. |
protected com.fasterxml.jackson.core.JsonToken |
_handleUnnamedValue()
|
protected void |
_readHeaderLine()
Method called to process the expected header line |
void |
_reportCsvError(String msg)
|
void |
_reportUnexpectedCsvChar(int ch,
String msg)
|
boolean |
canUseSchema(com.fasterxml.jackson.core.FormatSchema schema)
|
void |
close()
|
com.fasterxml.jackson.core.JsonParser |
configure(CsvParser.Feature f,
boolean state)
Method for enabling or disabling specified CSV feature (check CsvParser.Feature for list of features) |
com.fasterxml.jackson.core.JsonParser |
disable(CsvParser.Feature f)
Method for disabling specified CSV feature (check CsvParser.Feature for list of features) |
com.fasterxml.jackson.core.JsonParser |
enable(CsvParser.Feature f)
Method for enabling specified CSV feature (check CsvParser.Feature for list of features) |
BigInteger |
getBigIntegerValue()
|
byte[] |
getBinaryValue(com.fasterxml.jackson.core.Base64Variant variant)
|
com.fasterxml.jackson.core.ObjectCodec |
getCodec()
|
com.fasterxml.jackson.core.JsonLocation |
getCurrentLocation()
|
String |
getCurrentName()
|
BigDecimal |
getDecimalValue()
|
double |
getDoubleValue()
|
Object |
getEmbeddedObject()
|
float |
getFloatValue()
|
Object |
getInputSource()
|
int |
getIntValue()
|
long |
getLongValue()
|
com.fasterxml.jackson.core.JsonParser.NumberType |
getNumberType()
|
Number |
getNumberValue()
|
com.fasterxml.jackson.core.JsonStreamContext |
getParsingContext()
|
CsvSchema |
getSchema()
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) |
String |
getText()
|
char[] |
getTextCharacters()
|
int |
getTextLength()
|
int |
getTextOffset()
|
com.fasterxml.jackson.core.JsonLocation |
getTokenLocation()
|
boolean |
hasTextCharacters()
|
boolean |
isClosed()
|
boolean |
isEnabled(CsvParser.Feature f)
Method for checking whether specified CSV CsvParser.Feature
is enabled. |
com.fasterxml.jackson.core.JsonToken |
nextToken()
|
void |
overrideCurrentName(String name)
|
int |
releaseBuffered(Writer out)
|
void |
setCodec(com.fasterxml.jackson.core.ObjectCodec c)
|
void |
setSchema(com.fasterxml.jackson.core.FormatSchema schema)
|
com.fasterxml.jackson.core.Version |
version()
|
| 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 com.fasterxml.jackson.core.ObjectCodec _objectCodec
protected int _csvFeatures
protected CsvSchema _schema
protected int _columnCount
protected com.fasterxml.jackson.core.json.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 com.fasterxml.jackson.core.util.ByteArrayBuilder _byteArrayBuilder
| Constructor Detail |
|---|
public CsvParser(com.fasterxml.jackson.core.io.IOContext ctxt,
com.fasterxml.jackson.core.util.BufferRecycler br,
int parserFeatures,
int csvFeatures,
com.fasterxml.jackson.core.ObjectCodec codec,
Reader reader)
| Method Detail |
|---|
public com.fasterxml.jackson.core.Version version()
version in interface com.fasterxml.jackson.core.Versionedversion in class com.fasterxml.jackson.core.base.ParserMinimalBasepublic com.fasterxml.jackson.core.ObjectCodec getCodec()
getCodec in class com.fasterxml.jackson.core.JsonParserpublic void setCodec(com.fasterxml.jackson.core.ObjectCodec c)
setCodec in class com.fasterxml.jackson.core.JsonParserpublic boolean canUseSchema(com.fasterxml.jackson.core.FormatSchema schema)
canUseSchema in class com.fasterxml.jackson.core.JsonParserpublic void setSchema(com.fasterxml.jackson.core.FormatSchema schema)
setSchema in class com.fasterxml.jackson.core.JsonParser
public int releaseBuffered(Writer out)
throws IOException
releaseBuffered in class com.fasterxml.jackson.core.JsonParserIOExceptionpublic boolean isClosed()
isClosed in class com.fasterxml.jackson.core.base.ParserMinimalBase
public void close()
throws IOException
close in interface Closeableclose in class com.fasterxml.jackson.core.base.ParserMinimalBaseIOExceptionpublic com.fasterxml.jackson.core.JsonParser enable(CsvParser.Feature f)
CsvParser.Feature for list of features)
public com.fasterxml.jackson.core.JsonParser disable(CsvParser.Feature f)
CsvParser.Feature for list of features)
public com.fasterxml.jackson.core.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()
NOTE: should be part of JsonParser, will be for 2.0.
public com.fasterxml.jackson.core.JsonStreamContext getParsingContext()
getParsingContext in class com.fasterxml.jackson.core.base.ParserMinimalBasepublic com.fasterxml.jackson.core.JsonLocation getTokenLocation()
getTokenLocation in class com.fasterxml.jackson.core.JsonParserpublic com.fasterxml.jackson.core.JsonLocation getCurrentLocation()
getCurrentLocation in class com.fasterxml.jackson.core.JsonParserpublic Object getInputSource()
getInputSource in class com.fasterxml.jackson.core.JsonParser
public String getCurrentName()
throws IOException,
com.fasterxml.jackson.core.JsonParseException
getCurrentName in class com.fasterxml.jackson.core.base.ParserMinimalBaseIOException
com.fasterxml.jackson.core.JsonParseExceptionpublic void overrideCurrentName(String name)
overrideCurrentName in class com.fasterxml.jackson.core.base.ParserMinimalBase
public com.fasterxml.jackson.core.JsonToken nextToken()
throws IOException,
com.fasterxml.jackson.core.JsonParseException
nextToken in class com.fasterxml.jackson.core.base.ParserMinimalBaseIOException
com.fasterxml.jackson.core.JsonParseException
protected com.fasterxml.jackson.core.JsonToken _handleStartDoc()
throws IOException,
com.fasterxml.jackson.core.JsonParseException
IOException
com.fasterxml.jackson.core.JsonParseException
protected com.fasterxml.jackson.core.JsonToken _handleRecordStart()
throws IOException,
com.fasterxml.jackson.core.JsonParseException
IOException
com.fasterxml.jackson.core.JsonParseException
protected com.fasterxml.jackson.core.JsonToken _handleNextEntry()
throws IOException,
com.fasterxml.jackson.core.JsonParseException
IOException
com.fasterxml.jackson.core.JsonParseException
protected com.fasterxml.jackson.core.JsonToken _handleNamedValue()
throws IOException,
com.fasterxml.jackson.core.JsonParseException
IOException
com.fasterxml.jackson.core.JsonParseException
protected com.fasterxml.jackson.core.JsonToken _handleUnnamedValue()
throws IOException,
com.fasterxml.jackson.core.JsonParseException
IOException
com.fasterxml.jackson.core.JsonParseException
protected void _readHeaderLine()
throws IOException,
com.fasterxml.jackson.core.JsonParseException
IOException
com.fasterxml.jackson.core.JsonParseExceptionpublic boolean hasTextCharacters()
hasTextCharacters in class com.fasterxml.jackson.core.base.ParserMinimalBase
public String getText()
throws IOException,
com.fasterxml.jackson.core.JsonParseException
getText in class com.fasterxml.jackson.core.base.ParserMinimalBaseIOException
com.fasterxml.jackson.core.JsonParseException
public char[] getTextCharacters()
throws IOException,
com.fasterxml.jackson.core.JsonParseException
getTextCharacters in class com.fasterxml.jackson.core.base.ParserMinimalBaseIOException
com.fasterxml.jackson.core.JsonParseException
public int getTextLength()
throws IOException,
com.fasterxml.jackson.core.JsonParseException
getTextLength in class com.fasterxml.jackson.core.base.ParserMinimalBaseIOException
com.fasterxml.jackson.core.JsonParseException
public int getTextOffset()
throws IOException,
com.fasterxml.jackson.core.JsonParseException
getTextOffset in class com.fasterxml.jackson.core.base.ParserMinimalBaseIOException
com.fasterxml.jackson.core.JsonParseException
public Object getEmbeddedObject()
throws IOException,
com.fasterxml.jackson.core.JsonParseException
getEmbeddedObject in class com.fasterxml.jackson.core.JsonParserIOException
com.fasterxml.jackson.core.JsonParseException
public byte[] getBinaryValue(com.fasterxml.jackson.core.Base64Variant variant)
throws IOException,
com.fasterxml.jackson.core.JsonParseException
getBinaryValue in class com.fasterxml.jackson.core.base.ParserMinimalBaseIOException
com.fasterxml.jackson.core.JsonParseException
public com.fasterxml.jackson.core.JsonParser.NumberType getNumberType()
throws IOException,
com.fasterxml.jackson.core.JsonParseException
getNumberType in class com.fasterxml.jackson.core.JsonParserIOException
com.fasterxml.jackson.core.JsonParseException
public Number getNumberValue()
throws IOException,
com.fasterxml.jackson.core.JsonParseException
getNumberValue in class com.fasterxml.jackson.core.JsonParserIOException
com.fasterxml.jackson.core.JsonParseException
public int getIntValue()
throws IOException,
com.fasterxml.jackson.core.JsonParseException
getIntValue in class com.fasterxml.jackson.core.JsonParserIOException
com.fasterxml.jackson.core.JsonParseException
public long getLongValue()
throws IOException,
com.fasterxml.jackson.core.JsonParseException
getLongValue in class com.fasterxml.jackson.core.JsonParserIOException
com.fasterxml.jackson.core.JsonParseException
public BigInteger getBigIntegerValue()
throws IOException,
com.fasterxml.jackson.core.JsonParseException
getBigIntegerValue in class com.fasterxml.jackson.core.JsonParserIOException
com.fasterxml.jackson.core.JsonParseException
public float getFloatValue()
throws IOException,
com.fasterxml.jackson.core.JsonParseException
getFloatValue in class com.fasterxml.jackson.core.JsonParserIOException
com.fasterxml.jackson.core.JsonParseException
public double getDoubleValue()
throws IOException,
com.fasterxml.jackson.core.JsonParseException
getDoubleValue in class com.fasterxml.jackson.core.JsonParserIOException
com.fasterxml.jackson.core.JsonParseException
public BigDecimal getDecimalValue()
throws IOException,
com.fasterxml.jackson.core.JsonParseException
getDecimalValue in class com.fasterxml.jackson.core.JsonParserIOException
com.fasterxml.jackson.core.JsonParseException
protected void _handleEOF()
throws com.fasterxml.jackson.core.JsonParseException
_handleEOF in class com.fasterxml.jackson.core.base.ParserMinimalBasecom.fasterxml.jackson.core.JsonParseException
public void _reportCsvError(String msg)
throws com.fasterxml.jackson.core.JsonParseException
com.fasterxml.jackson.core.JsonParseException
public void _reportUnexpectedCsvChar(int ch,
String msg)
throws com.fasterxml.jackson.core.JsonParseException
com.fasterxml.jackson.core.JsonParseExceptionpublic com.fasterxml.jackson.core.util.ByteArrayBuilder _getByteArrayBuilder()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||