140141142143144145146147
* Use {@link ByteOutputStream} and {@link ByteOutputStream#write(InputStream)}. */ public static byte[] getBytes(InputStream is) throws IOException { ByteOutputStream bos = new ByteOutputStream(); bos.write(is); return bos.toByteArray(); } }
145146147148149150151152
try { bos.write(is); } finally { is.close(); } return bos.toByteArray(); } }