151152153154155156157158
* 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(); } }
160161162163164165166167
try { bos.write(is); } finally { is.close(); } return bos.toByteArray(); } }
169170171172173174175176
163164165166167168169170
} finally { if (bos != null) bos.close(); is.close(); } return bos.toByteArray(); } }