code: public static String inputStreamToString(InputStream in) {
          StringBuffer buffer = new StringBuffer();
          try {
              BufferedReader br = new BufferedReader(new InputStreamReader(in,
                      "UTF-8"), 1024);
              String line;
              while ((line = br.readLine()) != null) {
                  buffer.append(line);
              }
          } catch (IOException iox) {
              LOGR.warning(iox.getMessage());
          }
          return buffer.toString();
      }
docs: Reads the content of an input stream into a String value using the UTF-8
  charset.
  
  @param in
  The InputStream from which the content is read.
  @return A String representing the content of the input stream; an empty
  string is returned if an error occurs.