Example usage for java.io FilterInputStream available

List of usage examples for java.io FilterInputStream available

Introduction

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

Prototype

public int available() throws IOException 

Source Link

Document

Returns an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking by the next caller of a method for this input stream.

Usage

From source file:Main.java

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

    int i = 0;//  w  ww  .ja va  2 s.  c  om

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

    while ((i = fis.read()) != -1) {
        char c = (char) i;

        System.out.print("Read: " + c);

        int j = fis.available();

        System.out.println("; Available bytes: " + j);
    }
}