Class CsvReader

java.lang.Object
de.espirit.common.util.CsvReader

public class CsvReader extends Object
Utility class to parse CSV files.
Usage:
 
 final CsvReader csvReader = new CsvReader(reader, ';');
 CsvReader.CsvToken token = csvReader.read();
 while (token.getType() != CsvReader.CsvToken.EOF) {
     if (token.getType() == CsvReader.CsvToken.NEW_LINE) {
         // handle newline
     } else {
         // handle value
         final String value = token.getValue();
     }
     token = csvReader.read();
 }
  
Since:
5.1.28
  • Constructor Details

    • CsvReader

      public CsvReader(@NotNull @NotNull Reader reader, char delim)
      Constructs a new CsvReader with the given reader as source of the csv file and the given char as delimiter of the csv file
      Parameters:
      reader - reader for the csv file
      delim - the delimiter char of the csv file
      Since:
      5.1.28
    • CsvReader

      public CsvReader(@NotNull @NotNull Reader reader)
      Constructs a new CsvReader with the given reader as source of the csv file with default delimiter ';'.
      Parameters:
      reader - reader for the csv file
      Since:
      5.1.28
  • Method Details