I read this post but I am not following. I have seen this but have not seen a proper example of converting a ByteArrayInputStream to String using
ByteArrayInputStream
String
Use Base64 encoding
Assuming you got your ByteArrayOutputStream :
ByteArrayOutputStream baos =... String s = new String(Base64.Encoder.encode(baos.toByteArray()));
See http://docs.oracle.com/javase/8/docs/api/java/util/Base64.Encoder.html