Java FileInputStream.skip(long n)
Syntax
FileInputStream.skip(long n) has the following syntax.
public long skip(long n) throws IOException
Example
In the following code shows how to use FileInputStream.skip(long n) method.
//from w ww.j a va 2 s. c om
import java.io.IOException;
import java.io.FileInputStream;
public class Main {
public static void main(String[] args) throws IOException {
FileInputStream fis = new FileInputStream("C://test.txt");
// skip bytes from file input stream
fis.skip(4);
// read bytes from this stream
int i = fis.read();
// converts integer to character
char c = (char) i;
System.out.print("Character read: " + c);
}
}
Home »
Java Tutorial »
java.io »
Java Tutorial »
java.io »