code: public static String getText(Reader reader) throws IOException {
      try {
        StringBuilder source = new StringBuilder();
        BufferedReader buffered = new BufferedReader(reader);
        String line = buffered.readLine();
  
        while (line != null) {
          source.append(line);
          source.append('\n');
          line = buffered.readLine();
        }
  
        return source.toString();
      } finally {
        closeQuietly(reader);
      }
    }
docs: Returns the text read from the given reader as a String.
  Closes the given reader upon return.