Java ByteArrayInputStream.close()

Syntax

ByteArrayInputStream.close() has the following syntax.

public void close()  throws IOException

Example

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


//from   ww  w. j ava 2  s  . c  o m

import java.io.ByteArrayInputStream;
import java.io.IOException;

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

    byte[] buf = { 65, 66, 67, 68, 69 };

    ByteArrayInputStream bais = new ByteArrayInputStream(buf);

    bais.close();

    int count = bais.available();
  }
}