code: public static String readStreamToString(InputStream is, String encoding) throws IOException {
  		try {
  			StringBuilder sb = new StringBuilder();
  			byte[] buf = new byte[1024 * 10];
  			int read;
  			while ((read = is.read(buf)) >= 0) {
  				sb.append(new String(buf, 0, read, encoding));
  			}
  			return sb.toString();
  		} finally {
  			is.close();
  		}
  	}
docs: Reads a string from a stream. Closes the stream after reading.
  @param is the stream
  @param encoding the character encoding
  @return the string
  @throws IOException if the stream contents could not be read