Class StringEscapeUtils.Builder

  • Enclosing class:
    StringEscapeUtils

    public static final class StringEscapeUtils.Builder
    extends java.lang.Object

    Convenience wrapper for StringBuilder providing escape methods.

    Example:

     new Builder(ESCAPE_HTML4)
          .append("<p>")
          .escape("This is paragraph 1 and special chars like & get escaped.")
          .append("</p><p>")
          .escape("This is paragraph 2 & more...")
          .append("</p>")
          .toString()
     
    • Method Detail

      • append

        public StringEscapeUtils.Builder append​(java.lang.String input)
        Literal append, no escaping being done.
        Parameters:
        input - the String to append
        Returns:
        this, to enable chaining
      • toString

        public java.lang.String toString()

        Return the escaped string.

        Overrides:
        toString in class java.lang.Object
        Returns:
        The escaped string