List of usage examples for java.io LineNumberInputStream read
@SuppressWarnings("fallthrough") public int read() throws IOException
From source file:Main.java
public static void main(String[] args) throws IOException { int i;/*from w ww . j a va 2s . c om*/ 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); } }
From source file:Main.java
public static void main(String[] args) throws IOException { int i;/*from ww w .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; System.out.println(c); lnis.skip(1); } }
From source file:Main.java
public static void main(String[] args) throws IOException { int i;/*from w ww . ja va 2 s. c om*/ 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); } } }
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); int i;/*from w ww. j a v a2s .co m*/ while ((i = lnis.read()) != -1) { char c = (char) i; System.out.println("Character read: " + c); int j = lnis.available(); System.out.println("Available bytes: " + j); } }
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); System.out.println((char) lnis.read()); System.out.println((char) lnis.read()); lnis.mark(0);/* ww w. j a va 2 s .com*/ System.out.println("mark() invoked"); System.out.println((char) lnis.read()); System.out.println((char) lnis.read()); if (lnis.markSupported()) { lnis.reset(); System.out.println("reset() invoked"); System.out.println((char) lnis.read()); System.out.println((char) lnis.read()); } }
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); System.out.println((char) lnis.read()); System.out.println((char) lnis.read()); lnis.mark(0);//from w w w . j ava 2 s . c o m System.out.println("mark() invoked"); System.out.println((char) lnis.read()); System.out.println((char) lnis.read()); if (lnis.markSupported()) { lnis.reset(); System.out.println("reset() invoked"); System.out.println((char) lnis.read()); System.out.println((char) lnis.read()); } }