List of usage examples for java.io LineNumberInputStream read
public int read(byte b[], int off, int len) throws IOException
From source file:Main.java
public static void main(String[] args) throws IOException { byte[] buf = new byte[5]; char c;//from w ww . jav a 2s .c om FileInputStream fis = new FileInputStream("C:/test.txt"); LineNumberInputStream lnis = new LineNumberInputStream(fis); int i = lnis.read(buf, 2, 3); System.out.println("The number of char read: " + i); for (byte b : buf) { if (b == 0) c = '-'; else c = (char) b; System.out.print(c); } }