java.lang.Object
de.siegmar.fastcsv.reader.CsvParser
- All Implemented Interfaces:
Closeable,AutoCloseable
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final booleanprivate final CsvCallbackHandler<?> private final charprivate final CommentStrategyprivate final CsvParser.CsvBufferprivate booleanprivate final charprivate intprivate final charprivate longprivate intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final int -
Constructor Summary
ConstructorsConstructorDescriptionCsvParser(char fieldSeparator, char quoteCharacter, CommentStrategy commentStrategy, char commentCharacter, boolean acceptCharsAfterQuotes, CsvCallbackHandler<?> callbackHandler, Reader reader) CsvParser(char fieldSeparator, char quoteCharacter, CommentStrategy commentStrategy, char commentCharacter, boolean acceptCharsAfterQuotes, CsvCallbackHandler<?> callbackHandler, String data) -
Method Summary
Modifier and TypeMethodDescriptionprivate voidassertFields(char fieldSeparator, char quoteCharacter, char commentCharacter) private static intcleanDelimiters(char[] buf, int begin, int end, char quoteCharacter) Remove escapes from the field data.voidclose()(package private) booleanconsume(char[] lBuf, int lLen) longprivate voidmaterialize(char[] lBuf, int lBegin, int lPos, int lStatus, char quoteCharacter) (package private) booleanparse()(package private) StringpeekLine()private boolean(package private) voidreset(long startingLineNumber) (package private) booleanskipLine(int numCharsToSkip)
-
Field Details
-
STATUS_LAST_CHAR_WAS_CR
private static final int STATUS_LAST_CHAR_WAS_CR- See Also:
-
STATUS_COMMENTED_RECORD
private static final int STATUS_COMMENTED_RECORD- See Also:
-
STATUS_NEW_FIELD
private static final int STATUS_NEW_FIELD- See Also:
-
STATUS_QUOTED_MODE
private static final int STATUS_QUOTED_MODE- See Also:
-
STATUS_QUOTED_FIELD
private static final int STATUS_QUOTED_FIELD- See Also:
-
STATUS_DATA_FIELD
private static final int STATUS_DATA_FIELD- See Also:
-
STATUS_RESET
private static final int STATUS_RESET- See Also:
-
fsep
private final char fsep -
qChar
private final char qChar -
cStrat
-
cChar
private final char cChar -
acceptCharsAfterQuotes
private final boolean acceptCharsAfterQuotes -
callbackHandler
-
csvBuffer
-
startingLineNumber
private long startingLineNumber -
lines
private int lines -
status
private int status -
finished
private boolean finished
-
-
Constructor Details
-
CsvParser
CsvParser(char fieldSeparator, char quoteCharacter, CommentStrategy commentStrategy, char commentCharacter, boolean acceptCharsAfterQuotes, CsvCallbackHandler<?> callbackHandler, Reader reader) -
CsvParser
CsvParser(char fieldSeparator, char quoteCharacter, CommentStrategy commentStrategy, char commentCharacter, boolean acceptCharsAfterQuotes, CsvCallbackHandler<?> callbackHandler, String data)
-
-
Method Details
-
assertFields
private void assertFields(char fieldSeparator, char quoteCharacter, char commentCharacter) -
parse
- Throws:
IOException
-
processBufferTail
private boolean processBufferTail() -
consume
boolean consume(char[] lBuf, int lLen) -
materialize
private void materialize(char[] lBuf, int lBegin, int lPos, int lStatus, char quoteCharacter) -
cleanDelimiters
private static int cleanDelimiters(char[] buf, int begin, int end, char quoteCharacter) Remove escapes from the field data.The input buffer could look like this:
foo ""is"" bar- Parameters:
buf- the buffer containing the field databegin- the start position of the field data (after the opening quote)end- the end position of the field data (on the closing quote / end of buffer)quoteCharacter- the quote character- Returns:
- the length of the field data after removing escapes
-
getStartingLineNumber
public long getStartingLineNumber() -
reset
void reset(long startingLineNumber) -
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
peekLine
- Throws:
IOException
-
skipLine
- Throws:
IOException
-