OrangeSignal CSV ![Build Status](https://camo.githubusercontent.com/34f67bdb348918f256aeb6be6a57c6b5de793ab198b625d0c2e9a59f9646aa8e/68747470733a2f2f7472617669732d63692e6f72672f6f72616e67657369676e616c2f6f72616e67657369676e616c2d6373762e706e673f6272616e63683d6d6173746572)
OrangeSignal CSV is a very flexible csv (comma-separated values) read and write library for Java.
The binary distributions includes the following third party software:
jLHA (LHA Library for Java).
Prerequisites
- Java 1.6+
OrangeSignal CSV is compiled for Java 1.6
Installation
Maven users
If you are using Maven, simply copy the following dependency into your pom.xml file. The artifact is hosted at Maven Central, and is standalone (no dependencies).
<dependency>
<groupId>com.orangesignal</groupId>
<artifactId>orangesignal-csv</artifactId>
<version>2.2.1</version>
</dependency>
Examples
CSV entity class
@CsvEntity(header = true)
public class Customer {
@CsvColumn(name = "name")
public String name;
@CsvColumn(name = "age")
public Integer age;
}
example code
CsvConfig cfg = new CsvConfig(',', '"', '"');
cfg.setNullString("NULL");
cfg.setIgnoreLeadingWhitespaces(true);
cfg.setIgnoreTrailingWhitespaces(true);
cfg.setIgnoreEmptyLines(true);
cfg.setIgnoreLinePatterns(Pattern.compile("^#.*$"));
cfg.setVariableColumns(false);
List<Customer> list = new CsvEntityManager()
.config(cfg)
.load(Customer.class)
.filter(new SimpleBeanFilter().in("name", "Smith", "Johnson").gt("age", 21))
.offset(10)
.limit(1000)
.order(BeanOrder.desc("age"))
.from(reader);
How to use
Sorry, it is japanese only for now.
License
- Licensed under the Apache License, Version 2.0.