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 codepoint to a hex string of the form
"\\uXXXX" |
boolean |
translate(int codepoint,
Writer out)
Translate the specified codepoint into another.
|
translatehex, translate, translate, withpublic UnicodeEscaper()
Constructs a UnicodeEscaper for all characters.
protected UnicodeEscaper(int below, int above, boolean between)
Constructs a 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 codepoint boundaryabove - int value representing the highest codepoint boundarybetween - whether to escape between the boundaries or outside thempublic static UnicodeEscaper below(int codepoint)
Constructs a UnicodeEscaper below the specified value (exclusive).
codepoint - below which to escapeUnicodeEscaper instancepublic static UnicodeEscaper above(int codepoint)
Constructs a UnicodeEscaper above the specified value (exclusive).
codepoint - above which to escapeUnicodeEscaper instancepublic static UnicodeEscaper outsideOf(int codepointLow, int codepointHigh)
Constructs a UnicodeEscaper outside of the specified values (exclusive).
codepointLow - below which to escapecodepointHigh - above which to escapeUnicodeEscaper instancepublic static UnicodeEscaper between(int codepointLow, int codepointHigh)
Constructs a UnicodeEscaper between the specified values (inclusive).
codepointLow - above which to escapecodepointHigh - below which to escapeUnicodeEscaper instancepublic boolean translate(int codepoint, Writer out) throws IOException
translate in class CodePointTranslatorcodepoint - int character input to translateout - Writer to optionally push the translated output toIOException - if and only if the Writer produces an IOExceptionprotected String toUtf16Escape(int codepoint)
"\\uXXXX"codepoint - a Unicode code pointCopyright © 2001–2014 The Apache Software Foundation. All rights reserved.