code: protected String readString(final HttpURLConnection connection, final InputStream input)
  			throws IOException {
  		Charset charset = guessContentTypeCharset(connection);
  
  		StringBuilder sb = new StringBuilder();
  		BufferedReader reader = new BufferedReader(new InputStreamReader(input, charset));
  		try {
  			boolean first = true;
  			for (String line; (line = reader.readLine()) != null; ) {
  				if (!first) {
  					sb.append('\n');
  				}
  				sb.append(line);
  				first = false;
  			}
  		} finally {
  			closeLogExc(reader);
  		}
  
  		return sb.toString();
  	}
docs: Reads a string from an input stream, gets the charset from the content-type header.