List of usage examples for java.io LineNumberInputStream getLineNumber
public int getLineNumber()
From source file:Main.java
public static void main(String[] args) throws IOException { FileInputStream fis = new FileInputStream("C:/test.txt"); LineNumberInputStream lnis = new LineNumberInputStream(fis); lnis.setLineNumber(100);/* w w w . j av a 2 s . c o m*/ int i = lnis.getLineNumber(); System.out.print("Line number: " + i); }
From source file:Main.java
public static void main(String[] args) throws IOException { int i;/*from w ww . ja v a 2s . c o m*/ FileInputStream fis = new FileInputStream("C:/test.txt"); LineNumberInputStream lnis = new LineNumberInputStream(fis); while ((i = lnis.read()) != -1) { char c = (char) i; if (i != 10) { System.out.println("Character read: " + c); int j = lnis.getLineNumber(); System.out.println(" at line: " + j); } } }