Apache Commons CSV Documentation
repository·master·Indexed 19 days ago
https://github.com/apache/commons-csvA lightweight Java library designed to simplify the reading and writing of various types of CSV and delimited text files. It provides a simple interface and high-level abstractions for handling delimited data.
What's inside Apache Commons CSV
- Apache Commons CSV is a Java library that provides a simple interface for reading and writing CSV files of various types. It supports multiple formats and provides high-level abstractions for handling delimited data.
Run the standalone performance test
masterIf you only want to test the performance of
commons-csvspecifically, you can run a standalone performance test.Warning: Unlike the JMH benchmarks, this test uses simple timing metrics rather than the Java Microbenchmark Harness.
# Run the performance test mvn test -Dtest=PerformanceTestInstall benchmark prerequisites
masterBefore running benchmarks, you must manually install the Skife CSV implementation into your local Maven repository, as it is not available in Maven Central. Use the provided script to download and install the required JAR file.
./benchmark-prereq.shRun JMH benchmarks
masterApache Commons CSV uses the Java Microbenchmark Harness (JMH) to compare various CSV processing implementations. You can run all benchmarks or target a specific one using Maven profiles.
Available benchmark names include:
read: Java JDK (BufferedReader line count)scan: Java JDK (Scanner line count)split: Java JDK (BufferedReader delimiter split)parseCommonsCSV: commons-csv (CSVFormat delimiter split)parseGenJavaCSV: generation-java (CsvReader delimiter split)parseJavaCSV: java-csv (CsvReader delimiter split)parseOpenCSV: open-csv (CSVReader delimiter split)parseSkifeCSV: skife-csv (CSVReader delimiter split)parseSuperCSV: super-csv (CsvListReader delimiter split)
# Run all benchmark tests mvn test -Pbenchmark # Run a specific benchmark test mvn test -Pbenchmark -Dbenchmark=<name> # Example: running the basic "read" benchmark mvn test -Pbenchmark -Dbenchmark=readInstall Apache Commons CSV via Maven
masterTo use Apache Commons CSV in your Java project, add the following dependency to your
pom.xmlfile to pull it from the central Maven repositories.<dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-csv</artifactId> <version>1.14.1</version> </dependency>Access the Performance Test Harness
masterThe secondary performance test harness is located in the classorg.apache.commons.csv.PerformanceTest.