Example usage for java.io FilterInputStream skip

List of usage examples for java.io FilterInputStream skip

Introduction

In this page you can find the example usage for java.io FilterInputStream skip.

Prototype

public long skip(long n) throws IOException 

Source Link

Document

Skips over and discards n bytes of data from the input stream.

Usage

From source file:Main.java

public static void main(String[] args) throws Exception {

    int i = 0;//from w  w  w  .j  a v a 2s. c  om

    // create input streams
    InputStream is = new FileInputStream("C://test.txt");
    FilterInputStream fis = new BufferedInputStream(is);

    while ((i = fis.read()) != -1) {
        // converts integer to character
        char c = (char) i;

        // skips 3 bytes
        fis.skip(3);

        System.out.println("Character read: " + c);
    }

}