Tuesday, April 8, 2014

Convert Input Stream to ByteArray

Converting the Input Stream to Byte Array is very simple. You can org.apache.commons.io.IOUtils to get the job done quickly.

The IOUtils contains a method toByteArray which takes in a InputStream and converts the input stream into a byte Array.


byte[] byteArray = IOUtils.toByteArray(in);

No comments:

Post a Comment