By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,563 Members | 1,066 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,563 IT Pros & Developers. It's quick & easy.

read a file from different line number

P: 27
Hi All,

I have a text file.The file size is very big.I have to read the file from different line number.
e.g

File test.txt contains 10000000 lines and more.The 1st thread read the file from line 1 to 1000.2 nd thread read the file from line 1100 to 2000.3 rd thread read the file from line 2100 to 3000.. so on.

Please help me.

Thanks!
vaskar
Jun 3 '08 #1
Share this Question
Share on Google+
1 Reply


Expert 10K+
P: 11,448
Hi All,

I have a text file.The file size is very big.I have to read the file from different line number.
e.g

File test.txt contains 10000000 lines and more.The 1st thread read the file from line 1 to 1000.2 nd thread read the file from line 1100 to 2000.3 rd thread read the file from line 2100 to 3000.. so on.

Please help me.

Thanks!
vaskar
Better have one thread read the entire file and dispatch chunks of it to different
threads. A hard disk can 'read ahead' and your scenario spoils that. Also have
a look at the API documentation for the ByteBuffer class.

kind regards,

Jos
Jun 3 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.