code: public static String asUTF8String(InputStream in) {
          // Precondition check
          Validate.notNull(in, "Stream must be specified");
  
          StringBuilder buffer = new StringBuilder();
          String line;
  
          try {
              BufferedReader reader = new BufferedReader(new InputStreamReader(in, CHARSET_UTF8));
              while ((line = reader.readLine()) != null) {
                  buffer.append(line).append(Character.LINE_SEPARATOR);
              }
          } catch (IOException ioe) {
              throw new RuntimeException("Error in obtaining string from " + in, ioe);
          } finally {
              try {
                  in.close();
              } catch (IOException ignore) {
                  if (log.isLoggable(Level.FINER)) {
                      log.finer("Could not close stream due to: " + ignore.getMessage() + "; ignoring");
                  }
              }
          }
  
          return buffer.toString();
      }
docs: Obtains the contents of the specified stream as a String in UTF-8 charset.
  
  @param in
  @throws IllegalArgumentException
  If the stream was not specified