private String readToEnd(InputStream inputStream) {
        Scanner scanner = new Scanner(inputStream).useDelimiter("\\A");

        return scanner.hasNext() ? scanner.next() : "";
    }
private String readToEnd ( InputStream inputStream ) { Scanner scanner = new Scanner ( inputStream ) . useDelimiter ( "\\A" ) ; return scanner . hasNext ( ) ? scanner . next ( ) : "" ; }
Reads the stream until it has no more bytes and returns a UTF-8 encoded
string representation.

@param inputStream Stream to read from.
@return UTF-8 encoded string representation of stream's contents.