code: public static String readText(Reader reader) {
          BufferedReader in = new BufferedReader(reader);
          StringBuilder out = new StringBuilder(100);
          try {
              try {
                  char[] buf = new char[8192];
                  int n;
                  while ((n = in.read(buf)) >= 0) {
                      out.append(buf, 0, n);
                  }
              } finally {
                  in.close();
              }
          } catch (IOException e) {
              String msg = "The IOException occurred: reader=" + reader;
              throw new IllegalStateException(msg, e);
          }
          return out.toString();
      }
docs: ===============