code: public static String read(Reader reader) {
          StringWriter writer = new StringWriter();
          try {
              char[] buffer = new char[DEFAULT_BUFFER_SIZE];
              int n;
              while (-1 != (n = reader.read(buffer))) {
                  writer.write(buffer, 0, n);
              }
  
              return writer.toString();
          } catch (IOException ex) {
              throw new IllegalStateException("read error", ex);
          }
      }
docs: <p>read.</p>
  
  @param reader a {@link java.io.Reader} object.
  @return a {@link java.lang.String} object.