Java FilterInputStream.close()

Syntax

FilterInputStream.close() has the following syntax.

public void close()  throws IOException

Example

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


//from   w w w.  j  av  a  2s .  c om
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;

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

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

    // closes and releases the associated system resources
    fis.close();

    // read is called after close() invocation
    fis.read();

  }
}