Reputation: 41
I use openCSV to import files, but usually it reads only a part of a file. It deals with file containing ~5k rows but often 20k is problem for him (even CSV with 1 column).
When i tried to use BufferedReader instead of openCSV there wasnt problem with even 100k rows file but then i loose good openCSV parser.
Do you have any idea how to solve problem with openCSV or maybe you can recommend other good library for importing files in java?
Upvotes: 1
Views: 2129
Reputation: 1130
I just had an issue with OpenCSV 3.4. It could read only as much data as the BufferedReader's buffer size. It didn't matter whether my own BufferdReader was used or internal one.
I have resolved it by using OpenCSV 3.10. No problem there.
Upvotes: 0
Reputation: 983
My guess is that you have a bad csv file (ie you have a non escaped control character) and opencsv does not like that.
What I would suggest is that you look at the line after the last line processed and for giggles remove it and see if you get more processed after that. If so it is not a size matter and you now know which line is causing an issue.
As a disclaimer I am the maintainer of the opencsv project and I have performance tested opencsv with over a million records (CSVReader and CSVWriter) without issue - as long as you do the one by one methods.
Upvotes: 2
Reputation: 362
What do you want to do with the file? Have tried reading line by line ?
CSVReader reader = new CSVReader(new FileReader("yourfile.csv"));
String [] nextLine;
while ((nextLine = reader.readNext()) != null) {
// do whatever you want here
}
Upvotes: 0