Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

DeCS: Diergo Easy CSV Streamable CI status

This Java library supports parsing and generation of comma separated value (csv) data as defined in RFC 4180.

The format is a simple line based text format for table data. Many databases or spreadsheet software like MS-Excel can use this data as an interchange format. Each line is a row of the table, the column values are separated by a comma (or an other character). If the separator or quote character is part of a column value, the value has to be quoted.


The diergo.csv package contains a tool box to read and write CSV data using Java 8 Streams and functional interfaces. You can easily connect the functionaliy by using map(), filter() and collect() of a Stream. As there are no direct dependencies of the tools you can simply extend it for your needs by creating new lambdas or functional interfaces and inject them to mappings and filters:

  BiConsumer<String, RuntimeException> logger = (line, error) -> LoggerFactory.getLogger("CSV").warn("Cannot read CSV line '{}'", line, error);
  Function<String, List<Row>> parser = CsvParserBuilder.csvParser().separatedBy(',').handlingErrors(ErrorHandler.loggingErrors(logger).build();
  List<Map<String, String>> lines = Readers.asLines(new FileReader("input.csv", StandardCharsets.UTF_8))
      // CSV parser turns each line into a row
      // turn each line into a map, the first line is treated as header with column names
      // create a stream of rows with an initial header row containing the column names
      // CSV printer turns each row into one line
      .collect(Appendables.toAppendable(new FileWriter("output.csv", StandardCharsets.UTF_8), '\n'));

There are more ready to use helper functions to filter and map at Rows, Maps and Values. Handling of comments, headers and separators is configured using the builders for CSV parser and printer. For the release notes, have a look at the change log.

Dependency Release

To integrate the library in your project, add the artifact decs of group de.diergo to your Java dependency management. At JitPack you can find examples for Gradle and Maven. The library has no external dependencies.


This library is published under Apache License Version 2.0.


Diergo Easy CSV Streamable: a simple Java 8 CSV parser and generator.





No packages published