public class CsvDecoder extends Object
Modifier and Type | Field and Description |
---|---|
protected boolean |
_allowComments |
protected boolean |
_autoCloseInput |
protected boolean |
_bufferRecyclable
Flag that indicates whether the input buffer is recycable (and
needs to be returned to recycler once we are done) or not.
|
protected boolean |
_closed
Flag that indicates whether parser is closed or not.
|
protected long |
_currInputProcessed
Number of characters/bytes that were contained in previous blocks
(blocks that were already processed prior to the current buffer).
|
protected int |
_currInputRow
Current row location of current point in input buffer, starting
from 1, if available.
|
protected int |
_currInputRowStart
Current index of the first character of the current row in input
buffer.
|
protected int |
_escapeChar |
protected int |
_expLength
Length of the exponent part of the number, if any, not
including 'e' marker or sign, just digits.
|
protected int |
_fractLength
Length of the fractional part (not including decimal
point or exponent), in characters.
|
protected char[] |
_inputBuffer
Current buffer from which data is read; generally data is read into
buffer from input source, but in some cases pre-loaded buffer
is handed to the parser.
|
protected int |
_inputEnd
Index of character after last available one in the buffer.
|
protected int |
_inputPtr
Pointer to next available character in buffer
|
protected Reader |
_inputSource
Input stream that can be used for reading more content, if one
in use.
|
protected int |
_intLength
Length of integer part of the number, in characters
|
protected com.fasterxml.jackson.core.io.IOContext |
_ioContext
I/O context for this reader.
|
protected int |
_maxSpecialChar
Maximum of quote character, linefeeds (\r and \n), escape character.
|
protected BigDecimal |
_numberBigDecimal |
protected BigInteger |
_numberBigInt |
protected double |
_numberDouble |
protected int |
_numberInt |
protected long |
_numberLong |
protected boolean |
_numberNegative
Flag that indicates whether numeric value has a negative
value.
|
protected int |
_numTypesValid
Bitfield that indicates which numeric representations
have been calculated for the current type
|
protected CsvParser |
_owner
Unfortunate back reference, needed for error reporting
|
protected int |
_pendingLF
Marker to indicate that a linefeed was encountered and now
needs to be handled (indicates end-of-record).
|
protected int |
_quoteChar |
protected int |
_separatorChar |
protected TextBuffer |
_textBuffer
Buffer that contains contents of all values after processing
of doubled-quotes, escaped characters.
|
protected int |
_tokenInputCol
Column on input row that current token starts; 0-based (although
in the end it'll be converted to 1-based)
|
protected int |
_tokenInputRow
Input row on which current token starts, 1-based
|
protected long |
_tokenInputTotal
Total number of bytes/characters read before start of current token.
|
protected boolean |
_trimSpaces
Configuration flag that determines whether spaces surrounding
separator characters are to be automatically trimmed or not.
|
protected static char |
CHAR_NULL |
protected static int |
INT_0 |
protected static int |
INT_1 |
protected static int |
INT_2 |
protected static int |
INT_3 |
protected static int |
INT_4 |
protected static int |
INT_5 |
protected static int |
INT_6 |
protected static int |
INT_7 |
protected static int |
INT_8 |
protected static int |
INT_9 |
protected static int |
INT_DECIMAL_POINT |
protected static int |
INT_e |
protected static int |
INT_E |
protected static int |
INT_MINUS |
protected static int |
INT_PLUS |
protected static int |
NR_BIGDECIMAL |
protected static int |
NR_BIGINT |
protected static int |
NR_DOUBLE |
protected static int |
NR_INT |
protected static int |
NR_LONG |
protected static int |
NR_UNKNOWN |
Constructor and Description |
---|
CsvDecoder(CsvParser owner,
com.fasterxml.jackson.core.io.IOContext ctxt,
Reader r,
CsvSchema schema,
TextBuffer textBuffer,
int stdFeatures,
int csvFeatures) |
Modifier and Type | Method and Description |
---|---|
protected void |
_closeInput() |
protected static String |
_getCharDesc(int ch) |
protected void |
_handleLF() |
protected int |
_nextChar() |
protected String |
_nextQuotedString() |
protected String |
_nextUnquotedString(char[] outBuf,
int outPtr) |
protected void |
_parseNumericValue(int expType)
Method that will parse actual numeric value out of a syntactically
valid number value.
|
protected void |
_reportError(String msg)
Method for reporting low-level decoding (parsing) problems
|
protected int |
_skipCommentLines() |
protected int |
_skipLeadingSpace() |
protected char |
_unescape() |
com.fasterxml.jackson.core.json.JsonReadContext |
childArrayContext(com.fasterxml.jackson.core.json.JsonReadContext context) |
com.fasterxml.jackson.core.json.JsonReadContext |
childObjectContext(com.fasterxml.jackson.core.json.JsonReadContext context) |
void |
close() |
protected com.fasterxml.jackson.core.JsonParseException |
constructError(String msg,
Throwable t) |
protected void |
convertNumberToBigDecimal() |
protected void |
convertNumberToBigInteger() |
protected void |
convertNumberToDouble() |
protected void |
convertNumberToInt() |
protected void |
convertNumberToLong() |
BigInteger |
getBigIntegerValue() |
int |
getCurrentColumn() |
com.fasterxml.jackson.core.JsonLocation |
getCurrentLocation() |
int |
getCurrentRow() |
BigDecimal |
getDecimalValue() |
double |
getDoubleValue() |
float |
getFloatValue() |
Object |
getInputSource() |
int |
getIntValue() |
long |
getLongValue() |
com.fasterxml.jackson.core.JsonParser.NumberType |
getNumberType() |
Number |
getNumberValue() |
String |
getText() |
protected long |
getTokenCharacterOffset() |
protected int |
getTokenColumnNr() |
protected int |
getTokenLineNr() |
com.fasterxml.jackson.core.JsonLocation |
getTokenLocation() |
boolean |
hasMoreInput()
Method that can be called to see if there is at least one more
character to be parsed.
|
boolean |
isClosed() |
protected boolean |
loadMore() |
com.fasterxml.jackson.core.JsonToken |
nextNumber() |
com.fasterxml.jackson.core.JsonToken |
nextNumberOrString() |
String |
nextString()
Method called to parse the next token when we don't have any type
information, so that all tokens are exposed as basic String
values.
|
com.fasterxml.jackson.core.JsonToken |
nextStringOrLiteral() |
void |
overrideFormatFeatures(int csvFeatures) |
int |
releaseBuffered(Writer out) |
protected void |
releaseBuffers() |
protected void |
reportInvalidNumber(String msg) |
protected void |
reportOverflowInt() |
protected void |
reportOverflowLong() |
protected void |
reportUnexpectedNumberChar(int ch,
String comment) |
void |
setSchema(CsvSchema schema) |
void |
skipLeadingComments() |
boolean |
skipLine()
Method called to blindly skip a single line of content, without considering
aspects like quoting or escaping.
|
boolean |
startNewLine()
Method called to handle details of starting a new line, which may
include skipping a linefeed.
|
protected final CsvParser _owner
protected final com.fasterxml.jackson.core.io.IOContext _ioContext
protected Reader _inputSource
protected boolean _bufferRecyclable
If it is not, it also means that parser can NOT modify underlying buffer.
protected boolean _autoCloseInput
protected boolean _trimSpaces
protected boolean _allowComments
protected int _maxSpecialChar
protected int _separatorChar
protected int _quoteChar
protected int _escapeChar
protected final TextBuffer _textBuffer
protected char[] _inputBuffer
protected int _inputPtr
protected int _inputEnd
protected int _pendingLF
protected boolean _closed
close()
) or when end-of-input is reached.protected long _currInputProcessed
protected int _currInputRow
protected int _currInputRowStart
protected long _tokenInputTotal
protected int _tokenInputRow
protected int _tokenInputCol
protected static final int NR_UNKNOWN
protected static final int NR_INT
protected static final int NR_LONG
protected static final int NR_BIGINT
protected static final int NR_DOUBLE
protected static final int NR_BIGDECIMAL
protected static final int INT_0
protected static final int INT_1
protected static final int INT_2
protected static final int INT_3
protected static final int INT_4
protected static final int INT_5
protected static final int INT_6
protected static final int INT_7
protected static final int INT_8
protected static final int INT_9
protected static final int INT_MINUS
protected static final int INT_PLUS
protected static final int INT_DECIMAL_POINT
protected static final int INT_e
protected static final int INT_E
protected static final char CHAR_NULL
protected int _numTypesValid
protected int _numberInt
protected long _numberLong
protected double _numberDouble
protected BigInteger _numberBigInt
protected BigDecimal _numberBigDecimal
protected boolean _numberNegative
protected int _intLength
protected int _fractLength
protected int _expLength
public CsvDecoder(CsvParser owner, com.fasterxml.jackson.core.io.IOContext ctxt, Reader r, CsvSchema schema, TextBuffer textBuffer, int stdFeatures, int csvFeatures)
public void setSchema(CsvSchema schema)
public void overrideFormatFeatures(int csvFeatures)
public Object getInputSource()
public boolean isClosed()
public void close() throws IOException
IOException
public int releaseBuffered(Writer out) throws IOException
IOException
public com.fasterxml.jackson.core.json.JsonReadContext childArrayContext(com.fasterxml.jackson.core.json.JsonReadContext context)
public com.fasterxml.jackson.core.json.JsonReadContext childObjectContext(com.fasterxml.jackson.core.json.JsonReadContext context)
public com.fasterxml.jackson.core.JsonLocation getTokenLocation()
public com.fasterxml.jackson.core.JsonLocation getCurrentLocation()
public final int getCurrentRow()
public final int getCurrentColumn()
protected final long getTokenCharacterOffset()
protected final int getTokenLineNr()
protected final int getTokenColumnNr()
protected void releaseBuffers() throws IOException
IOException
protected void _closeInput() throws IOException
IOException
protected final boolean loadMore() throws IOException
IOException
public String getText()
public boolean hasMoreInput() throws IOException
IOException
public boolean startNewLine() throws IOException
IOException
public void skipLeadingComments() throws IOException
IOException
protected int _skipCommentLines() throws IOException
IOException
public boolean skipLine() throws IOException
IOException
public String nextString() throws IOException
IOException
public com.fasterxml.jackson.core.JsonToken nextStringOrLiteral() throws IOException
IOException
public com.fasterxml.jackson.core.JsonToken nextNumber() throws IOException
IOException
public com.fasterxml.jackson.core.JsonToken nextNumberOrString() throws IOException
IOException
protected String _nextUnquotedString(char[] outBuf, int outPtr) throws IOException
IOException
protected String _nextQuotedString() throws IOException
IOException
protected final void _handleLF() throws IOException
IOException
protected char _unescape() throws IOException
IOException
protected final int _nextChar() throws IOException
IOException
protected final int _skipLeadingSpace() throws IOException
IOException
public Number getNumberValue() throws IOException
IOException
public com.fasterxml.jackson.core.JsonParser.NumberType getNumberType() throws IOException
IOException
public int getIntValue() throws IOException
IOException
public long getLongValue() throws IOException
IOException
public BigInteger getBigIntegerValue() throws IOException
IOException
public float getFloatValue() throws IOException
IOException
public double getDoubleValue() throws IOException
IOException
public BigDecimal getDecimalValue() throws IOException
IOException
protected void _parseNumericValue(int expType) throws IOException
expType
- Numeric type that we will immediately need, if any;
mostly necessary to optimize handling of floating point numbersIOException
protected void convertNumberToInt() throws IOException
IOException
protected void convertNumberToLong() throws IOException
IOException
protected void convertNumberToBigInteger() throws IOException
IOException
protected void convertNumberToDouble() throws IOException
IOException
protected void convertNumberToBigDecimal() throws IOException
IOException
protected void reportUnexpectedNumberChar(int ch, String comment) throws com.fasterxml.jackson.core.JsonParseException
com.fasterxml.jackson.core.JsonParseException
protected void reportInvalidNumber(String msg) throws com.fasterxml.jackson.core.JsonParseException
com.fasterxml.jackson.core.JsonParseException
protected void reportOverflowInt() throws IOException
IOException
protected void reportOverflowLong() throws IOException
IOException
protected final com.fasterxml.jackson.core.JsonParseException constructError(String msg, Throwable t)
protected static final String _getCharDesc(int ch)
protected final void _reportError(String msg) throws com.fasterxml.jackson.core.JsonParseException
com.fasterxml.jackson.core.JsonParseException
Copyright © 2016 FasterXML. All rights reserved.