Java IO Tutorial - Java LineNumberInputStream .skip (long n)








Syntax

LineNumberInputStream.skip(long n) has the following syntax.

public long skip(long n)  throws IOException

Example

In the following code shows how to use LineNumberInputStream.skip(long n) method.

/*from   w w w  . ja v a 2 s.  com*/
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.println(c);

      lnis.skip(1);
    }

  }
}