Get the response body as string

@param charset charset for the byte to String conversion
@return body as string
@throws IOException if the stream is not accessible
547680
public String getStringBody(Charset charset) throws IOException {
        BufferedReader rd = new BufferedReader(new InputStreamReader(getInputStreamBody(), charset));
        String line;
        StringBuilder response = new StringBuilder();
        while ((line = rd.readLine()) != null) {
            if (response.length() != 0) {
                response.append('\n');
            }
            response.append(line);
        }
        rd.close();
        return response.toString();
    }
169281
private String getResponseBody(HttpResponse postResponse) {
        InputStream input = null;
        try {
            input = postResponse.getEntity().getContent();
            Reader reader = new InputStreamReader(input,
                    MwsUtl.DEFAULT_ENCODING);
            StringBuilder b = new StringBuilder();
            char[] c = new char[1024];
            int len;
            while (0 < (len = reader.read(c))) {
                b.append(c, 0, len);
            }
            return b.toString();
        } catch (Exception e) {
            throw MwsUtl.wrap(e);
        } finally {
            MwsUtl.close(input);
        }
    }
381677
protected String getCharsetFromBytes(byte buffer[], int len) 
	throws IOException {
		String charsetName = null;
	    UniversalDetector detector = new UniversalDetector(null);
		detector.handleData(buffer, 0, len);
		detector.dataEnd();
	    charsetName = detector.getDetectedCharset();
	    detector.reset();
	    if(isCharsetSupported(charsetName)) {
	    	return mapCharset(charsetName);
	    }
	    return null;
	}
89000
public String getStreamAsString(String encoding) throws IOException {
		String result = null;
		try {
			result = IOUtils.toString(getStream(), encoding);
		}
		catch (NullPointerException npex) {
			throw new IOException("Timeout has been forced by CommonHttpClient", npex);
		}
		return result;
	}
354358
public static String charset(final String encoding)
    {
        final String charsetName = STD_CHARSETS.get(encoding);
        if (charsetName != null)
        {
            return "java.nio.charset.StandardCharsets." + charsetName;
        }
        else
        {
            return "java.nio.charset.Charset.forName(\"" + encoding + "\")";
        }
    }
170340
public String getString(Charset charset) throws IOException
    {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        byte cc = get();
        while (cc != 0)
        {
            baos.write(cc);
            cc = get();
        }
        byte[] buf = baos.toByteArray();
        return new String(buf, charset);
    }
602792
public String printBody() throws IOException {
        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
        this.printBody(baos);
        return new Utf8String(baos.toByteArray()).asString();
    }
623282
public static byte[] asBytes(String string, Charset charset)
    {
        if (string == null)
        {
            return null;
        }

        if (charset == null)
        {
            throw new IllegalArgumentException("Cannot get bytes without a Charset");
        }

        try
        {
            return string.getBytes(charset.name());
        }
        catch (UnsupportedEncodingException e)
        {
            //since we are using *actual* charsets, not string lookups, this
            //should *never* happen. But it is better to throw it up than swallow it.
            throw new IllegalStateException("Charset present", e);
        }
    }
1265676
private static Charset getCharset(String charset)
    {
        try
        {
            return Charset.forName(charset);
        }
        catch (final UnsupportedCharsetException exception)
        {
            Verbose.exception(exception);
            return Charset.defaultCharset();
        }
    }
983135
public <T> Message body(T body, Charset charset) {
        messageWriter.writeBody(body, charset);
        return this;
    }
1301137
public static String doGet(String url, Map<String, String> params, String charset) throws IOException {
        HttpURLConnection conn = null;
        String rsp = null;

        try {
            String ctype = "application/x-www-form-urlencoded;charset=" + charset;
            String query = buildQuery(params, charset);
            conn = getConnection(buildGetUrl(url, query), METHOD_GET, ctype, null);

            rsp = getResponseAsString(conn);
        } finally {
            if (conn != null) {
                conn.disconnect();
            }
        }

        return rsp;
    }
897174
public static Action charset(final String charset) {
        return new Action(r -> {
            r.setCharacterEncoding(charset);
            return r;
        });
    }
1094053
public Object parse(InputStream inputStream, String charset) {
        if (inputStream == null) {
            throw new IllegalArgumentException("inputStream must not be null");
        }
        if (charset == null) {
            throw new IllegalArgumentException("charset must not be null");
        }

        Object content;
        content = createParser().parse(inputStream, charset);
        return content;
    }
127646
public SoapServerFaultResponseActionBuilder charset(String charsetName) {
        if (!getAction().getAttachments().isEmpty()) {
            getAction().getAttachments().get(getAction().getAttachments().size() - 1).setCharsetName(charsetName);
        }
        return this;
    }
1144794
protected static function convertBodyEncoding($body, $charset = '', $encoding = -1)
    {
        if ('' === $charset) {
            $charset = static::$charset;
        }

        if (!mb_check_encoding($body, $charset)) {
            $charset = mb_detect_encoding($body);
        }

        if ($charset === static::$charset) {
            return $body;
        }

        if (!in_array($charset, mb_list_encodings())) {
            $charset = $encoding === ENC7BIT ? 'US-ASCII' : static::$charset;
        }

        return mb_convert_encoding($body, static::$charset, $charset);
    }
1254423
public RawResponse charset(Charset charset) {
        return new RawResponse(method, url, statusCode, statusLine, cookies, headers, body, charset, decompress);
    }
853654
public final static String getHeader(String headerKey, String charset) {
		return ServletUtil.getHeader(getServletRequest(), headerKey, charset);
	}