Convert InputStream(Image) to ByteArrayInputStream

Viewed 59227

Not sure about how I am supposed to do this. Any help would be appreciated

3 Answers

You can use org.apache.commons.io.IOUtils#toByteArray(java.io.InputStream)

InputStream is = getMyInputStream();
ByteArrayInputStream bais = new ByteArrayInputStream(IOUtils.toByteArray(is));
Related