Code Example for BufferedInputStream: available() method

BufferedInputStream available() method returns the total count of bytes that can be read or skipped over from the input stream without blocking by next invocation of a method for the input stream. The next invocation might be the same thread or another thread. A single read or skip of this many bytes will not block, but may read or skip fewer bytes.

 * *********************************************************************************
 *  * Created on 2011 Copyright(c) All Rights Reserved.
 *  *********************************************************************************


 * Created by
 * User:
 * Date: 3/20/11
 * Time: 3:49 PM
public class BufferedInputStreamAvailable {
    public static void main(String args[]) throws IOException {

        FileInputStream fileInputStream = new FileInputStream(new File("/test.txt"));
	    BufferedInputStream bufferedInputStream = new BufferedInputStream(fileInputStream);
        if (bufferedInputStream.available() > 0) {
            do {
            } while (bufferedInputStream.available() > 0);


Please Post Your Comments & Reviews

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.