import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import javax.swing.JLabel;
import javax.swing.ProgressMonitorInputStream;
public class MainClass {
public static void main(String[] a) throws Exception {
String fileName = "BigFile.txt";
FileInputStream fis = new FileInputStream(fileName);
JLabel filenameLabel = new JLabel(fileName, JLabel.RIGHT);
Object message[] = { "Reading:", filenameLabel };
ProgressMonitorInputStream pmis = new ProgressMonitorInputStream(null, message, fis);
InputStreamReader isr = new InputStreamReader(pmis);
BufferedReader br = new BufferedReader(isr);
String line;
while ((line = br.readLine()) != null) {
System.out.println(line);
}
br.close();
}
}
|