ByteArrayOutputStream
ByteArrayOutputStream is a class in Java's input/output API that implements an output stream in which data can be written without generating any input/output exceptions. It is part of the java.io package. Essentially, it acts as a buffer that stores data as a sequence of bytes.
The primary purpose of ByteArrayOutputStream is to write data into memory rather than to a file or
Key methods include write(int b) to write a single byte, write(byte[] b, int off, int len) to
ByteArrayOutputStream is not thread-safe. If multiple threads access a ByteArrayOutputStream instance concurrently, and at least one