how to convert outputstream to bytearrayoutputstream in java

Solutions on MaxInterview for how to convert outputstream to bytearrayoutputstream in java by the best coders in the world

showing results for - "how to convert outputstream to bytearrayoutputstream in java"
Phil
01 Aug 2016
1ByteArrayOutputStream bos = new ByteArrayOutputStream();
2    
3//Write the data to the byte array output stream here
4	
5byte[] arr = bos.toByteArray();
6//write the byte stream to the output stream
7os.write(arr);