I have the following method the reads text file:
public static void readFile(String path) {
BufferedReader br = null;
try {
String sCurrentLine;
br = new BufferedReader(new FileReader(path));
while ((sCurrentLine = br.readLine()) != null) {
System.out.println(sCurrentLine); // Progress indicator!
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (br != null)br.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
My file is really large ~ 700MB, I would love to be able to print progress indicator or percentage instead of printing the actual file on the console which really does not look good. Something probably like this:
========================================================== 100%
Any hint is appreciated.