question: public static String readStream ( InputStream inputStream ) throws IOException { if ( inputStream == null ) { return null ; } ByteArrayOutputStream bout = new ByteArrayOutputStream ( ) ; byte [ ] buf = new byte [ 8192 ] ; int r ; while ( ( r = inputStream . read ( buf ) ) != - 1 ) { bout . write ( buf , 0 , r ) ; } return bout . toString ( "UTF-8" ) ; }
target:  Reads bytes from input stream and builds a string from them.