Jul 26, 2018

Java ByteArrayOutputStream class stream creates a buffer in memory and all the data sent to the stream is stored in the buffer.

The size of buffer grows automatically as data is written to it.

Java ByteArrayOutputStream class is used to write common data into multiple files.

The ByteArrayInputStream and ByteArrayOutputStream read data from and write data to a byte array in memory, respectively. So they are fast.