Example usage for java.io LineNumberInputStream available

List of usage examples for java.io LineNumberInputStream available

Introduction

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

Prototype

public int available() throws IOException 

Source Link

Document

Returns the number of bytes that can be read from this input stream without blocking.

Usage

From source file:Main.java

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

    FileInputStream fis = new FileInputStream("C:/test.txt");
    LineNumberInputStream lnis = new LineNumberInputStream(fis);
    int i;/*from   w ww .j  av  a  2s  .  c o  m*/
    while ((i = lnis.read()) != -1) {

        char c = (char) i;

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

        int j = lnis.available();

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

}