code: public static String getContent(Reader in) throws IOException {
      try {
        StringWriter sw = new StringWriter();
        copy(in, sw);
        return sw.toString();
      }
      finally {
        in.close();
      }
    }
docs: Returns the content of the specified reader. The reader will be closed after calling this method.
  @param in the reader to read
  @return the content of the reader
  @throws java.io.IOException if an I/O error occurs