I need to read a very big log file (about 400MB) and display its content in a textarea.
Obviously I can't read the whole file first, because of its dimension, so I am looking for a method that can read the first n lines (or portion of bytes) and then, when asked, start reading the next n lines, and so on. The method needs to work in both directions: i.e. if the lines from 1000 to 1500 are displayed and the user wants to read back, I have to display the lines from 500 to 1000.
I am trying with RandomAccessFile
, LineIterator
and classic BufferedReader
approach, but those don't seem to be good solutions.
Thanks in advance.