question: protected byte [ ] inputStreamToByteArray ( InputStream is ) throws IOException { ByteArrayOutputStream bos = new ByteArrayOutputStream ( ) ; int next = is . read ( ) ; while ( next > - 1 ) { bos . write ( next ) ; next = is . read ( ) ; } bos . flush ( ) ; is . close ( ) ; return bos . toByteArray ( ) ; }
target:  Reads an input stream into a byte array