I want to read large amount of data (5 Lakh lines of data) from a file within a time limit of 1 Sec. I tried to use buffered reader, but it is taking more than 9 Sec. Is there any other efficient api available in java for reading large amount of data?
Obviously reading from a file is constrained by hardware, so the answer is probably to get faster hardware.
Using streams will probably be faster than using a reader because readers do codepage conversion. Of course, you lose that convenient readLine() method.
RandomAccessFile has a readLine() method, but it doesn't support the full Unicode charset. I don't know if it's faster.
The "new" IO classes may offer other options. For the most part, they introduce functionality which was not available in the "old" io classes and the old io classes actually use NIO under the covers, so performance may or may not be better.