LineNumberInputStream.read(byte[] b, int off, int len) has the following syntax.
public int read(byte[] b, int off, int len) throws IOException
In the following code shows how to use LineNumberInputStream.read(byte[] b, int off, int len) method.
//from ww w . j av a 2 s .c om import java.io.FileInputStream; import java.io.IOException; import java.io.LineNumberInputStream; public class Main { public static void main(String[] args) throws IOException { byte[] buf = new byte[5]; char c; 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); } } }