opencsv
Description
A Simple CSV Parser for Java under a commercial-friendly Apache 2.0 license
Categories
License
Update Notifications
User Ratings
User Reviews
-
Nice little library, but I really wish quotes weren't mandatory in the writer. Until that's resolved I just can't use this. The Javadoc is a bit confusing, I guess it is out of sync with the current release, since it shows boolean flags to address that in writeNext() which don't appear to be available in the current release (2.3 I think). I'd also prefer a CSVWriter constructor argument flag to disable quotes for all calls to writeNext() rather than having to specify the preference on every write. IMO the "typical" case would not require quotes for every single value. Another nice thing (haven't thought about how it'd be implemented) would be a way to specify an auto-quote preference on specific columns. I will check the repo to see if there's a newer version which addresses some of this, but until some of these are addressed in the convenient release download I'm afraid I have to give this a "- 1/2" rounded down to -1. Will update with a new review if the quote issue gets fixed...
-
Got a Error while trying to use CSVtoBean class Caused by: java.lang.NullPointerException at au.com.bytecode.opencsv.bean.HeaderColumnNameMappingStrategy.createBean(Unknown Source) at au.com.bytecode.opencsv.bean.CsvToBean.processLine(Unknown Source) ... 2 more Testing Code: import java.io.FileNotFoundException; import java.io.FileReader; import java.util.List; import au.com.bytecode.opencsv.CSVReader; import au.com.bytecode.opencsv.bean.ColumnPositionMappingStrategy; import au.com.bytecode.opencsv.bean.CsvToBean; public class OpenCSVTest { /** * @param args * @throws FileNotFoundException */ public static void main(String[] args) throws FileNotFoundException { /* Offer is a simple POJO class */ ColumnPositionMappingStrategy<Offer> colStrt = new ColumnPositionMappingStrategy<Offer>(); CsvToBean<Offer> c2b = new CsvToBean<Offer>(); CSVReader reader = new CSVReader(new FileReader("C:/offer.csv")); List<Offer> offerList = c2b.parse(colStrt, reader); for (Offer offer: offerList) { System.out.println(offer.toString()); } } }
-
Nice project! You did a great job. Thank you!