我有以下方法读取文本文件:如何输出进度指示器,而不是实际的文件内容
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();
}
}
}
我的文件确实是大〜700MB,我很想能够打印进度指示器或而不是在控制台上打印真正不太好的实际文件。可能是这样的东西:
========================================================== 100%
任何提示表示赞赏。
也许http://stackoverflow.com/questions/23167319/how-to-use-java-progress-bar-while-read-a-text-file可以帮助吗? – GuiSim