Simple Java CSV reading and writing library using Java annotations
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.circleci cp Jul 2, 2018
src some tweaks Mar 18, 2018
.gitignore cp Nov 23, 2014
LICENSE.txt Update LICENSE.txt Jul 5, 2017
README.md Update README.md Apr 25, 2018
RELEASE.txt cp Nov 25, 2014
TODO.txt cp Jun 2, 2016
pom.xml [maven-release-plugin] prepare for next development iteration Feb 23, 2018
release.sh cp Jul 2, 2018

README.md

Simple Java CSV Reader / Writer

This package provides some Java classes to help with the reading and writing of CSV files using Java annotations.

Enjoy, Gray Watson

Quick Example:

Define your entity with the fields marked with the @CsvColumn annotation, can also mark get/set methods:

public class Account {
	@CsvColumn(columnName = "Name")
	private String name;
	@CsvColumn(columnName = "Account Number")
	private long number;
	...
}

Create a CSV processor for the Account class.

CsvProcessor<Account> csvProcessor = new CsvProcessor<Account>(Account.class);

Write out all of the accounts from a list of them to a CSV file with a header:

File csvFile = new File(CSV_FILE_PATH);
csvProcessor.writeAll(csvFile, accountList, true /* write header */);

This generates the following output:

"Name","Account Number"
"Bill Smith",1
"Foo Bar",2
"Jim Jimston",3

Now read those accounts back in with an optional error handler:

List<Account> readAccounts = csvProcessor.readAll(csvFile, null /* error handler */);

ChangeLog Release Notes

See the ChangeLog.txt file.