Loading...

A library for CSV handling.

Maven

<dependency>
	<groupId>org.apache.commons</groupId>
	<artifactId>commons-csv</artifactId>
	<version>1.4</version>
</dependency>

Read Records

Parsing default CSV format (comma separated)

String configurationColumns = "recordId,produktCode,bestellungsArt,abonnementNummer,artikelNummer";

List<String> columns = new LinkedList<>();
Reader in = new StringReader(configurationColumns);
Iterable<CSVRecord> parser = CSVFormat.DEFAULT.parse(in);
for (CSVRecord record : parser) {
    // access each value, field via Iterator
    Iterator<String> it = record.iterator();
    while (it.hasNext()) {
        columns.add(it.next());
    }
}