Java tutorial
import java.io.FileInputStream; import java.io.IOException; import java.io.LineNumberInputStream; public class Main { public static void main(String[] args) throws IOException { int i; FileInputStream fis = new FileInputStream("C:/test.txt"); LineNumberInputStream lnis = new LineNumberInputStream(fis); while ((i = lnis.read()) != -1) { char c = (char) i; System.out.print(c); } } }