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 a ByteArrayOutputStream
.
To retrieve the contents of a ByteArrayInputStream
as a String
, is using a ByteArrayOutputstream
recommended or is there a more preferable way?
I was considering this example and extend ByteArrayInputStream
and utilize a Decorator to increase functionality at run time. Any interest in this being a better solution to employing a ByteArrayOutputStream
?
InputStreamReader
, as described in the second link that you gave. AByteArrayOutputStream
won't convert the bytes to characters. – ZondraThe problem with this is that it reads only up to and including the first line separator. It assumes that the string you're looking for does not contain any line separators. Often that's true, but if not, this won't really work.
Why I am not proceeding with that example. – Eumenides