I am trying to convert an OutputStream to a ByteArrayOutput Stream. I was unable to find any clear simple answers on how to do this. This question wa
OutputStream
ByteArrayOutput
You can use toByteArray function on the output stream you have.That's is let say you have outputStream buffer So you can do buffer.toByteArray .
toByteArray
buffer.toByteArray
For more you can look at the answer of Convert InputStream to byte array in Java .