private static class CharEscaperBuilder.CharArrayDecorator extends CharEscaper
Modifier and Type | Field and Description |
---|---|
private int |
replaceLength |
private char[][] |
replacements |
Constructor and Description |
---|
CharArrayDecorator(char[][] replacements) |
Modifier and Type | Method and Description |
---|---|
protected char[] |
escape(char c)
Returns the escaped form of the given character, or
null if this character does not
need to be escaped. |
java.lang.String |
escape(java.lang.String s)
Returns the escaped form of a given literal string.
|
escapeSlow
asFunction
private final char[][] replacements
private final int replaceLength
public java.lang.String escape(java.lang.String s)
CharEscaper
escape
in class CharEscaper
s
- the literal string to be escapedstring
@CheckForNull protected char[] escape(char c)
CharEscaper
null
if this character does not
need to be escaped. If an empty array is returned, this effectively strips the input character
from the resulting text.
If the character does not need to be escaped, this method should return null
, rather
than a one-character array containing the character itself. This enables the escaping algorithm
to perform more efficiently.
An escaper is expected to be able to deal with any char
value, so this method should
not throw any exceptions.
escape
in class CharEscaper
c
- the character to escape if necessarynull
if no escaping was needed