How to read a large text file quickly without memory error in Java?
What is the best method to read a big file very efficiently?
Kindly check the program Java Read File Line by Line - Java Tutorial.
This is one of the good tutorial with source code to read file efficiently.
Basically you will have to read the file one line at a time in order to get rid off the memory errors.