code: public static String getText(BufferedReader reader) throws IOException {
          StringBuilder answer = new StringBuilder();
          // reading the content of the file within a char buffer
          // allow to keep the correct line endings
          char[] charBuffer = new char[8192];
          int nbCharRead /* = 0*/;
          try {
              while ((nbCharRead = reader.read(charBuffer)) != -1) {
                  // appends buffer
                  answer.append(charBuffer, 0, nbCharRead);
              }
              Reader temp = reader;
              reader = null;
              temp.close();
          } finally {
              closeWithWarning(reader);
          }
          return answer.toString();
      }
docs: Read the content of the BufferedReader and return it as a String.
  The BufferedReader is closed afterwards.
  
  @param reader a BufferedReader whose content we want to read
  @return a String containing the content of the buffered reader
  @throws IOException if an IOException occurs.
  @since 1.0