code: protected String createDefaultExcerpt(String text,
                                            String excerptStart,
                                            String excerptEnd,
                                            String fragmentStart,
                                            String fragmentEnd,
                                            int maxLength) throws IOException {
          StringReader reader = new StringReader(text);
          StringBuilder excerpt = new StringBuilder(excerptStart);
          excerpt.append(fragmentStart);
          if (!text.isEmpty()) {
              int min = excerpt.length();
              char[] buf = new char[maxLength];
              int len = reader.read(buf);
              StringBuilder tmp = new StringBuilder();
              tmp.append(buf, 0, len);
              if (len == buf.length) {
                  for (int i = tmp.length() - 1; i > min; i--) {
                      if (Character.isWhitespace(tmp.charAt(i))) {
                          tmp.delete(i, tmp.length());
                          tmp.append(" ...");
                          break;
                      }
                  }
              }
              excerpt.append(Text.encodeIllegalXMLCharacters(tmp.toString()));
          }
          excerpt.append(fragmentEnd).append(excerptEnd);
          return excerpt.toString();
      }
docs: Creates a default excerpt with the given text.
  
  @param text the text.
  @param excerptStart the excerpt start.
  @param excerptEnd the excerpt end.
  @param fragmentStart the fragement start.
  @param fragmentEnd the fragment end.
  @param maxLength the maximum length of the fragment.
  @return a default excerpt.
  @throws IOException if an error occurs while reading from the text.