InputStream.close() has the following syntax.
public void close() throws IOException
In the following code shows how to use InputStream.close() method.
/*from ww w . java2 s. c o m*/ import java.io.FileInputStream; import java.io.InputStream; public class Main { public static void main(String[] args) throws Exception { // new input stream created InputStream is = new FileInputStream("C://test.txt"); // invoke available int i = is.available(); // number of bytes available is printed System.out.println(i); // releases any system resources associated with the stream is.close(); // throws io exception on available() invocation i = is.available(); System.out.println(i); } }