public class Entities extends Object
Modifier and Type | Class and Description |
---|---|
(package private) static class |
Entities.CoreCharset |
static class |
Entities.EscapeMode |
Modifier and Type | Field and Description |
---|---|
private static char[] |
codeDelims |
(package private) static int |
codepointRadix |
private static Document.OutputSettings |
DefaultOutput |
private static int |
empty |
private static String |
emptyName |
private static HashMap<String,String> |
multipoints |
Modifier | Constructor and Description |
---|---|
private |
Entities() |
Modifier and Type | Method and Description |
---|---|
private static void |
appendEncoded(Appendable accum,
Entities.EscapeMode escapeMode,
int codePoint) |
private static boolean |
canEncode(Entities.CoreCharset charset,
char c,
CharsetEncoder fallback) |
static int |
codepointsForName(String name,
int[] codepoints) |
(package private) static void |
escape(Appendable accum,
String string,
Document.OutputSettings out,
boolean inAttribute,
boolean normaliseWhite,
boolean stripLeadingWhite) |
static String |
escape(String string)
HTML escape an input string, using the default settings (UTF-8, base entities).
|
static String |
escape(String string,
Document.OutputSettings out)
HTML escape an input string.
|
static String |
getByName(String name)
Get the character(s) represented by the named entity
|
static Character |
getCharacterByName(String name)
Deprecated.
does not support characters outside the BMP or multiple character names
|
static boolean |
isBaseNamedEntity(String name)
Check if the input is a known named entity in the base entity set.
|
static boolean |
isNamedEntity(String name)
Check if the input is a known named entity
|
private static void |
load(Entities.EscapeMode e,
String pointsData,
int size) |
static String |
unescape(String string)
Un-escape an HTML escaped string.
|
(package private) static String |
unescape(String string,
boolean strict)
Unescape the input string.
|
private static final int empty
private static final String emptyName
static final int codepointRadix
private static final char[] codeDelims
private static final HashMap<String,String> multipoints
private static final Document.OutputSettings DefaultOutput
private Entities()
public static boolean isNamedEntity(String name)
name
- the possible entity name (e.g. "lt" or "amp")public static boolean isBaseNamedEntity(String name)
name
- the possible entity name (e.g. "lt" or "amp")isNamedEntity(String)
public static Character getCharacterByName(String name)
name
- named entity (e.g. "lt" or "amp")public static String getByName(String name)
name
- entity (e.g. "lt" or "amp")public static int codepointsForName(String name, int[] codepoints)
public static String escape(String string, Document.OutputSettings out)
<
is returned as <
string
- the un-escaped string to escapeout
- the output settings to usepublic static String escape(String string)
<
is returned as
<
string
- the un-escaped string to escapestatic void escape(Appendable accum, String string, Document.OutputSettings out, boolean inAttribute, boolean normaliseWhite, boolean stripLeadingWhite) throws IOException
IOException
private static void appendEncoded(Appendable accum, Entities.EscapeMode escapeMode, int codePoint) throws IOException
IOException
public static String unescape(String string)
<
is returned as <
.string
- the HTML string to un-escapestatic String unescape(String string, boolean strict)
string
- to un-HTML-escapestrict
- if "strict" (that is, requires trailing ';' char, otherwise that's optional)private static boolean canEncode(Entities.CoreCharset charset, char c, CharsetEncoder fallback)
private static void load(Entities.EscapeMode e, String pointsData, int size)
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses