* @throws IOException if an I/O error occurs
*/
public static byte[] toByteArray(final InputStream input) throws IOException {
ByteArrayOutputStream output = new ByteArrayOutputStream();
IOUtils.copy(input, output);
return output.toByteArray();
}
/**
* Get contents of an <code>InputStream</code> as a <code>byte[]</code>.
* Use this method instead of <code>toByteArray(InputStream)</code>
* when <code>InputStream</code> size is known.