Java ByteArrayOutputStream.close()
Syntax
ByteArrayOutputStream.close() has the following syntax.
public void close() throws IOException
Example
In the following code shows how to use ByteArrayOutputStream.close() method.
/* ww w.java 2s . c o m*/
import java.io.ByteArrayOutputStream;
import java.io.IOException;
public class Main {
public static void main(String[] args) throws IOException {
byte[] buf = { 65, 66, 67, 68, 69 };
ByteArrayOutputStream baos = new ByteArrayOutputStream();
baos.close();
baos.write(buf);
System.out.print(baos.toString());
}
}
The code above generates the following result.
Home »
Java Tutorial »
java.io »
Java Tutorial »
java.io »