docs: public static String readString(Reader is, String term) throws IOException {
          CharArrayWriter baos = new CharArrayWriter();
  
          int ch_int;
          char last = term.charAt(term.length() - 1);
          while ((ch_int = is.read()) >= 0) {
              final char ch = (char) ch_int;
              baos.write(ch);
              if (ch == last && baos.size() >= term.length()) {
                  String tmp = baos.toString();
                  if (tmp.substring(tmp.length() - term.length())
                         .equals(term)) {
                      return tmp.substring(0, tmp.length() - term.length());
                  }
              }
          }
  
          return baos.toString();
      }