Package toxi.data.csv

Class CSVParser

java.lang.Object
toxi.data.csv.CSVParser

public class CSVParser extends Object
An event-based CSV data parser with support for field aliases. Parse events are generated for single rows and total completion (or failures). This allows the parsing to function asynchronously in its own thread.
  • Constructor Details

  • Method Details

    • getDispatcher

      public EventDispatcher<CSVListener> getDispatcher()
      Returns:
      the dispatcher
    • getMapper

      public CSVFieldMapper getMapper()
      Returns:
      the mapper
    • parse

      public void parse(String[] lines)
      Parses the given String array of CSV text lines and emits parse events for clients to process individual rows. The first row (1st array index) is assumed to contain the fieldnames, just as it would be the case with a standard CSV file.
      Parameters:
      lines - array of CSV formatted lines of text
    • setMapper

      public void setMapper(CSVFieldMapper mapper)
      Parameters:
      mapper - the mapper to set