Menu

#43 Support random access reader (read a specific row range)

Outstanding
closed
nobody
None
1
2015-01-23
2014-01-24
cf126330
No

I'm evaluating it to use with java batch applications (JSR-352) to implement csv javax.batch.api.chunk.ItemReader and javax.batch.api.chunk.ItemWriter. One of the difficulties is supercsv doesn't support random access read. For example, for a csv file with 1000 rows, I need to read row 500 to row 600 only.

Currently I extend AbstractCsvReader and calling getRow() repeatedly till the desired starting row. It avoids populating beans and running processors, but still doesn't seem very efficient.

I noticed CommentMatcher can be used to skip reading unwanted rows, but it doesn't keep row counting for skipped rows.

Discussion

  • Kasper B. Graversen

    You have to parse the file in order to know when a line ends and a new begins due to a row may span multiple lines.

     
  • Kasper B. Graversen

    • status: open --> closed
     

Log in to post a comment.