Java InputStream.skip(long n)
Syntax
InputStream.skip(long n) has the following syntax.
public long skip(long n) throws IOException
Example
In the following code shows how to use InputStream.skip(long n) method.
// w w w . j a va 2 s. co m
import java.io.FileInputStream;
import java.io.InputStream;
public class Main {
public static void main(String[] args) throws Exception {
int i;
InputStream is = new FileInputStream("C://test.txt");
while ((i = is.read()) != -1) {
// converts int to char
char c = (char) i;
System.out.println("Character Read: " + c);
// skip one byte
is.skip(1);
}
is.close();
}
}
Home »
Java Tutorial »
java.io »
Java Tutorial »
java.io »