- All Superinterfaces:
Appender<Appendable>
,Function<String,
String>
An Escaper is an
Appender
used to escape content such as HTML. A
Formatter
is usually what will call the Escaper and like a formatter should be
singleton like and expect reuse.- Author:
- agentgt
- See Also:
-
Method Details
-
apply
Escapes a String by using StringBuilder and callingAppender.append(Appendable, CharSequence)
.- Specified by:
apply
in interfaceFunction<String,
String> - Parameters:
t
- String to ge escaped.- Returns:
- escaped content
- Throws:
UncheckedIOException
- if the appender or appendable throw anIOException
-
of
Adapts a function to an Escaper. If the function is already an Escaper then it is simply returned (noop). Thus it is safe to repeatedly call this on Escaper. If the function is adapted the returned adapted Escaper does not pass native types to the inputted function.- Parameters:
escapeFunction
- returned if it is already an escaper- Returns:
- adapted Escaper
-