GithubHelp home page GithubHelp logo

bireports / simplecsv Goto Github PK

View Code? Open in Web Editor NEW

This project forked from j256/simplecsv

0.0 1.0 0.0 1.42 MB

Simple Java CSV reading and writing library using Java annotations

Home Page: http://256stuff.com/sources/simplecsv/

License: ISC License

Shell 1.46% Makefile 0.27% Java 98.27%

simplecsv's Introduction

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.

simplecsv's People

Contributors

j256 avatar iamareebjamal avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.