public class XMLEntityCodec extends Codec
| Modifier and Type | Field and Description |
|---|---|
private static java.lang.String |
ALPHA_NUMERIC_STR |
private static HashTrie<java.lang.Character> |
entityToCharacterMap |
private static java.util.Set<java.lang.Character> |
UNENCODED_SET |
private static java.lang.String |
UNENCODED_STR |
| Constructor and Description |
|---|
XMLEntityCodec() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Character |
decodeCharacter(PushbackString input)
Returns the decoded version of the next character from the input string and advances the
current character in the PushbackString.
|
java.lang.String |
encodeCharacter(char[] immune,
java.lang.Character c)
Default implementation that should be overridden in specific codecs.
|
private java.lang.Character |
getNamedEntity(PushbackString input)
Converts the rest of a named entity to a character.
|
private static java.lang.Character |
getNumericEntity(PushbackString input)
Converts the rest of a numeric entity to a character.
|
private static java.lang.Character |
int2char(int i)
Convert a integer code point to a Character.
|
private static java.lang.Character |
parseHex(PushbackString input)
Converts the rest of a hexidecimal numeric entity to a character.
|
private static java.lang.Character |
parseNumber(PushbackString input)
Converts the rest of a decimal numeric entity to a character.
|
containsCharacter, decode, encode, getHexForNonAlphanumeric, toHex, toOctalprivate static final java.lang.String ALPHA_NUMERIC_STR
private static final java.lang.String UNENCODED_STR
private static final java.util.Set<java.lang.Character> UNENCODED_SET
private static final HashTrie<java.lang.Character> entityToCharacterMap
public java.lang.String encodeCharacter(char[] immune,
java.lang.Character c)
encodeCharacter in class Codecimmune - characters that should not be encoded as entitiesc - the Character to encodepublic java.lang.Character decodeCharacter(PushbackString input)
decodeCharacter in class Codecinput - the Character to decodeprivate static java.lang.Character getNumericEntity(PushbackString input)
input - The input to read from. It is assumed that input
is positioned at the character after the &#private static java.lang.Character int2char(int i)
i - the integerprivate static java.lang.Character parseNumber(PushbackString input)
input - The input to read from. It is assumed that input
is positioned at the character after the &# and that
the next char is not a 'x' or 'X'.private static java.lang.Character parseHex(PushbackString input)
input - The input to read from. It is assumed that input
is positioned at the character after the &#[xX]private java.lang.Character getNamedEntity(PushbackString input)
input - The input to read from. It is assumed that input
is positioned at the character after the &.