question: public static byte [ ] convertInputStreamToByteArray ( InputStream inputStream , int inputStreamLength ) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream ( ) ; int blockSize = DEFAULT_BUFFER_SIZE ; byte [ ] buffer = new byte [ blockSize ] ; int left = inputStreamLength ; while ( left > 0 ) { int read = inputStream . read ( buffer , 0 , left > blockSize ? blockSize : left ) ; if ( read == - 1 ) break ; out . write ( buffer , 0 , read ) ; left -= read ; } return out . toByteArray ( ) ; }
target:  Converts an input stream to a byte array