close(): This method is available in the java.io.ByteArrayOutputStream class of Java.
Syntax:
void java.io.ByteArrayOutputStream.close() throws IOException
This method closes a ByteArrayOutputStream. The methods in this class can be called after the stream has been closed without generating an IOException.
Parameters: NA
Returns: NA
Throws:
IOException - if an I/O error occurs.
Approach
Java
import java.io.ByteArrayOutputStream;import java.io.IOException;public class ByteArrayOutputStreamclose {public static void main(String[] args) throws IOException {int size = 5;ByteArrayOutputStream byteArrayOutputStream =new ByteArrayOutputStream(size);System.out.println("Closing the buffer");byteArrayOutputStream.close();}}
Output:
Closing the buffer
No comments:
Post a Comment