Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Read only specified number of rows from a .csv file  RSS feed

 
anusha banu
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can any one tell the code how to implement the below requirement.

Need to parse the csv file. If the file contains 1000 rows i need to read the only specified number of rows.

For Ex: 1-100

If i want to read data from 501- 600 again i need to use the same logic.

Thanks in advance.

Regards,
Anusha.
 
Swastik Dey
Rancher
Posts: 1812
15
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
RandomAccessFile should solve your problem.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

To use RandomAccessFile one would need to know how long each line of the file is, which is unlikely.

You can't avoid reading lines prior to the ones you're interested in, but there should be no problem discarding those, and also to stop reading afterwards.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!