private static String streamToString(InputStream is) {
        java.util.Scanner s = new java.util.Scanner(is, "UTF-8").useDelimiter("\\A");
        return s.hasNext() ? s.next() : "";
    }
private static String streamToString(InputStream is) {
        java.util.Scanner s = new java.util.Scanner(is, "UTF-8").useDelimiter("\\A");
        return s.hasNext() ? s.next() : "";
    }
private static String streamToString ( InputStream is ) { java . util . Scanner s = new java . util . Scanner ( is , "UTF-8" ) . useDelimiter ( "\\A" ) ; return s . hasNext ( ) ? s . next ( ) : "" ; }
Convert an InputStream into a String object. Method taken from http://stackoverflow.com/a/5445161/521535

@param is The stream to be converted
@return The resulting String
Convert an InputStream into a String object . Method taken from http : // stackoverflow . com / a / 5445161 / 521535