public class UnicodeEscaper extends CodePointTranslator
| Modifier | Constructor and Description |
|---|---|
|
UnicodeEscaper()
Constructs a
UnicodeEscaper for all characters. |
protected |
UnicodeEscaper(int below,
int above,
boolean between)
Constructs a
UnicodeEscaper for the specified range. |
| Modifier and Type | Method and Description |
|---|---|
static UnicodeEscaper |
above(int codePoint)
Constructs a
UnicodeEscaper above the specified value (exclusive). |
static UnicodeEscaper |
below(int codePoint)
Constructs a
UnicodeEscaper below the specified value (exclusive). |
static UnicodeEscaper |
between(int codePointLow,
int codePointHigh)
Constructs a
UnicodeEscaper between the specified values (inclusive). |
static UnicodeEscaper |
outsideOf(int codePointLow,
int codePointHigh)
Constructs a
UnicodeEscaper outside of the specified values (exclusive). |
protected String |
toUtf16Escape(int codePoint)
Converts the given code point to a hex string of the form
"\\uXXXX". |
boolean |
translate(int codePoint,
Writer writer)
Translates the specified code point into another.
|
translatehex, translate, translate, withpublic UnicodeEscaper()
UnicodeEscaper for all characters.protected UnicodeEscaper(int below, int above, boolean between)
UnicodeEscaper for the specified range. This is
the underlying method for the other constructors/builders. The below
and above boundaries are inclusive when between is
true and exclusive when it is false.below - int value representing the lowest code point boundaryabove - int value representing the highest code point boundarybetween - whether to escape between the boundaries or outside thempublic static UnicodeEscaper above(int codePoint)
UnicodeEscaper above the specified value (exclusive).codePoint - above which to escapeUnicodeEscaper instancepublic static UnicodeEscaper below(int codePoint)
UnicodeEscaper below the specified value (exclusive).codePoint - below which to escapeUnicodeEscaper instancepublic static UnicodeEscaper between(int codePointLow, int codePointHigh)
UnicodeEscaper between the specified values (inclusive).codePointLow - above which to escapecodePointHigh - below which to escapeUnicodeEscaper instancepublic static UnicodeEscaper outsideOf(int codePointLow, int codePointHigh)
UnicodeEscaper outside of the specified values (exclusive).codePointLow - below which to escapecodePointHigh - above which to escapeUnicodeEscaper instanceprotected String toUtf16Escape(int codePoint)
"\\uXXXX".codePoint - a Unicode code pointpublic boolean translate(int codePoint, Writer writer) throws IOException
translate in class CodePointTranslatorcodePoint - int character input to translatewriter - Writer to optionally push the translated output toIOException - if and only if the Writer produces an IOExceptionCopyright © 2014–2022 The Apache Software Foundation. All rights reserved.