public static String streamToString ( final InputStream stream , final String charset , final BuffersPool buffersPool ) throws IOException { ByteArrayOutputStream output = new ByteArrayOutputStream ( ) ; transfer ( stream , output , buffersPool ) ; return new String ( output . toByteArray ( ) , charset ) ; }
Read all the bytes from input stream and convert them to a string . Input stream is closed after this method invocation .