question: public static byte [ ] read ( InputStream in ) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream ( ) ; int read = 0 ; byte [ ] buff = new byte [ 1024 ] ; while ( ( read = in . read ( buff ) ) > 0 ) { out . write ( buff , 0 , read ) ; } in . close ( ) ; out . flush ( ) ; out . close ( ) ; return out . toByteArray ( ) ; }
target:  Reads an input stream and writes it to a byte array