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.
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);