Open In App

Java.io.ByteArrayOutputStream() Class in Java

java.io.ByteArrayOutputStream class creates an Output Stream for writing data into byte array. The size of buffer grows automatically as data is written to it. There is no affect of closing the byteArrayOutputStream on the working of it’s methods. They can be called even after closing the class.
Thus, no methods throws IO exception.



Declaration:

public class ByteArrayOutputStream
   extends OutputStream

Fields:



  • protected byte[] buf – The buffer where data is stored.
  • protected int count – The number of valid bytes in the buffer.
  • Constructors :

    Methods:

    Article Tags :