public abstract class UnicodeEscaper extends Object implements Escaper
| Constructor and Description |
|---|
UnicodeEscaper() |
| Modifier and Type | Method and Description |
|---|---|
protected static int |
codePointAt(CharSequence seq,
int index,
int end) |
Appendable |
escape(Appendable out)
Returns an
Appendable instance which automatically escapes all
text appended to it before passing the resulting text to an underlying
Appendable. |
protected abstract char[] |
escape(int cp)
Returns the escaped form of the given Unicode code point, or
null
if this code point does not need to be escaped. |
String |
escape(String string)
Returns the escaped form of a given literal string.
|
protected String |
escapeSlow(String s,
int index) |
protected int |
nextEscapeIndex(CharSequence csq,
int start,
int end) |
protected abstract char[] escape(int cp)
null
if this code point does not need to be escaped. When called as part of an
escaping operation, the given code point is guaranteed to be in the range
0 <= cp <= Character#MAX_CODE_POINT.
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 an array containing the character
representation of the code point. This enables the escaping algorithm to
perform more efficiently.
If the implementation of this method cannot correctly handle a particular code point then it should either throw an appropriate runtime exception or return a suitable replacement character. It must never silently discard invalid input as this may constitute a security risk.
cp - the Unicode code point to escape if necessarynull if no escaping was
neededprotected int nextEscapeIndex(CharSequence csq, int start, int end)
public String escape(String string)
EscaperNote that this method may treat input characters differently depending on the specific escaper implementation.
public Appendable escape(Appendable out)
EscaperAppendable instance which automatically escapes all
text appended to it before passing the resulting text to an underlying
Appendable.
Note that this method may treat input characters differently depending on the specific escaper implementation.
protected static final int codePointAt(CharSequence seq, int index, int end)
Copyright © 2008–2017. All rights reserved.