Java BufferedInputStream.close()

Syntax

BufferedInputStream.close() has the following syntax.

public void close()  throws IOException

Example

In the following code shows how to use BufferedInputStream.close() method.


import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.InputStream;
/*www . jav a  2s  .c om*/
public class Main {
  public static void main(String[] args) throws Exception {

    InputStream inStream = new FileInputStream("c:/test.txt");
    BufferedInputStream bis = new BufferedInputStream(inStream);

    int byteNum = bis.available();

    System.out.println(byteNum);

    bis.close();

    byteNum = bis.available();
    System.out.println(byteNum);

  }
}