public static String getInputStreamAsString ( InputStream is ) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; ReadableByteChannel rbch = Channels . newChannel ( is ) ; WritableByteChannel wbch = Channels . newChannel ( baos ) ; fastChannelCopy ( rbch , wbch ) ; rbch . close ( ) ; wbch . close ( ) ; return new String ( baos . toByteArray ( ) , Charset . forName ( "UTF-8" ) ) ; }
converts input stream to string value