Class CsvParser

java.lang.Object
de.siegmar.fastcsv.reader.CsvParser
All Implemented Interfaces:
Closeable, AutoCloseable

final class CsvParser extends Object implements Closeable
  • 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

      private final CommentStrategy cStrat
    • cChar

      private final char cChar
    • acceptCharsAfterQuotes

      private final boolean acceptCharsAfterQuotes
    • callbackHandler

      private final CsvCallbackHandler<?> callbackHandler
    • csvBuffer

      private final CsvParser.CsvBuffer 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

      boolean parse() throws IOException
      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 data
      begin - 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

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException