@Beta @GwtCompatible public abstract class ArrayBasedCharEscaper extends CharEscaper
CharEscaper that uses an array to quickly look up replacement
characters for a given char value. An additional safe range is
provided that determines whether char values without specific
replacements are to be considered safe and left unescaped or should be
escaped in a general way.
A good example of usage of this class is for Java source code escaping
where the replacement array contains information about special ASCII
characters such as \\t and \\n while escapeUnsafe(char)
is overridden to handle general escaping of the form \\uxxxx.
The size of the data structure used by ArrayBasedCharEscaper is
proportional to the highest valued character that requires escaping.
For example a replacement map containing the single character
'\u1000' will require approximately 16K of memory. If you
need to create multiple escaper instances that have the same character
replacement mapping consider using ArrayBasedEscaperMap.
| Modifier and Type | Method and Description |
|---|---|
String |
escape(String s)
Returns the escaped form of a given literal string.
|
asFunctionpublic final String escape(String s)
CharEscaperescape in class CharEscapers - the literal string to be escapedstringCopyright © 2010 - 2020 Adobe. All Rights Reserved