|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.utexas.its.eis.tools.qwicap.util.HTMLEntityCodec
public final class HTMLEntityCodec
HTMLEntityCodec
converts most control characters, various reserved characters (ampersands,
double-quotes, chevrons, etc.), and all Unicode characters greater than or equal to 127, to and from HTML
character entity references. When encoding, the symbolic form of HTML character entities (e.g. "·") are
always used in preference to the numeric forms (e.g. "·"). All character entity references specified in
the HTML 4 specification are supported.
Constructor Summary | |
---|---|
HTMLEntityCodec()
Creates an HTMLEntityCodec instance for translating back and forth between Unicode characters and HTML
character entity references. |
|
HTMLEntityCodec(boolean EncodeDoubleQuotes)
Creates an HTMLEntityCodec instance for translating back and forth between Unicode characters and HTML
character entity references. |
Method Summary | |
---|---|
Characters |
decode(Characters EnStr)
Decodes a string, represented as a Characters object, by translating HTML character entity references into
corresponding Unicode characters. |
boolean |
decode(Characters EnStr,
StringBuffer Buff)
Decodes a string, represented as a Characters object, by translating HTML character entity references into
corresponding Unicode characters. |
boolean |
decode(Characters EnStr,
StringBuilder Buff)
Decodes a string, represented as a Characters object, by translating HTML character entity references into
corresponding Unicode characters. |
String |
decode(String EnStr)
Decodes a string by translating HTML character entity references into Unicode characters. |
boolean |
decode(String EnStr,
StringBuffer Buff)
Decodes a string by translating HTML character entity references into corresponding Unicode characters. |
boolean |
decode(String EnStr,
StringBuilder Buff)
Decodes a string by translating HTML character entity references into corresponding Unicode characters. |
Characters |
encode(Characters UnStr)
Encodes a Unicode string, represented as a Characters object, by translating characters into HTML
character entity references, as needed. |
boolean |
encode(Characters UnStr,
StringBuffer Buff)
Encodes a Unicode string, represented as a Characters object, by translating characters into HTML character
entity references, as needed. |
boolean |
encode(Characters UnStr,
StringBuilder Buff)
Encodes a Unicode string, represented as a Characters object, by translating characters into HTML character
entity references, as needed. |
boolean |
encode(CharSequence UnStr,
StringBuffer Buff)
Encodes a Unicode character sequence by translating characters into HTML character entity references, as needed. |
boolean |
encode(CharSequence UnStr,
StringBuilder Buff)
Encodes a Unicode character sequence by translating characters into HTML character entity references, as needed. |
String |
encode(String UnStr)
Encodes a Unicode string by translating characters into HTML character entity references, as needed. |
String |
getEncoding(char Char)
Returns the encoded form of the specified Unicode character as a String , or returns null ,
if the character will be left unchanged. |
HTMLEntityCodec |
setEncoding(char Char,
String Encoded)
Sets the encoded form of the specified Unicode character. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HTMLEntityCodec()
HTMLEntityCodec
instance for translating back and forth between Unicode characters and HTML
character entity references. Double-quote characters are translated to/from the HTML character entity reference
""". Unprintable characters are omitted. Line separator characters ('\n') are left unaltered.
public HTMLEntityCodec(boolean EncodeDoubleQuotes)
HTMLEntityCodec
instance for translating back and forth between Unicode characters and HTML
character entity references.
EncodeDoubleQuotes
- true
if the double-quote character (") should be replaced by an HTML
character entity reference, false
if it should be left unchanged.Method Detail |
---|
public String getEncoding(char Char)
String
, or returns null
,
if the character will be left unchanged.
Char
- The character to be encoded.
String
, or null
if the character
doesn't need to be encoded.public HTMLEntityCodec setEncoding(char Char, String Encoded)
Char
- The character for which an encoding is being specified.Encoded
- The encoding to be used for the specified character, or null
, if the character
should be left unchanged.
HTMLEntityCodec
instance.public String encode(String UnStr)
UnStr
- A Unicode string.
public boolean encode(CharSequence UnStr, StringBuffer Buff)
UnStr
- A Unicode character sequence.Buff
- A StringBuffer
to which the output of this method is to be appended. The
buffer is not cleared.
true
if any characters were encoded, false
if no characters
were encoded.public boolean encode(CharSequence UnStr, StringBuilder Buff)
UnStr
- A Unicode character sequence.Buff
- A StringBuilder
to which the output of this method is to be appended. The
buffer is not cleared.
true
if any characters were encoded, false
if no characters
were encoded.public Characters encode(Characters UnStr)
Characters
object, by translating characters into HTML
character entity references, as needed.
UnStr
- A Unicode string.
public boolean encode(Characters UnStr, StringBuffer Buff)
Characters
object, by translating characters into HTML character
entity references, as needed.
UnStr
- A Unicode string.Buff
- A StringBuffer
to which the output of this method is to be appended. The
buffer is not cleared.
true
if any characters were encoded, false
if no characters
were encoded.public boolean encode(Characters UnStr, StringBuilder Buff)
Characters
object, by translating characters into HTML character
entity references, as needed.
UnStr
- A Unicode string.Buff
- A StringBuilder
to which the output of this method is to be appended. The
buffer is not cleared.
true
if any characters were encoded, false
if no characters
were encoded.public String decode(String EnStr)
EnStr
- The string to be decoded.
String
in which all of HTML character entity references in the original
string have been translated into their Unicode equivalents.public boolean decode(String EnStr, StringBuffer Buff)
EnStr
- The string to be decoded.Buff
- A StringBuffer
to which the output of this method is to be appended. The
buffer is not cleared.
true
if any characters were decoded, false
if no characters
were decoded.public boolean decode(String EnStr, StringBuilder Buff)
EnStr
- The string to be decoded.Buff
- A StringBuilder
to which the output of this method is to be appended. The
buffer is not cleared.
true
if any characters were decoded, false
if no characters
were decoded.public Characters decode(Characters EnStr)
Characters
object, by translating HTML character entity references into
corresponding Unicode characters.
EnStr
- The string to be decoded.
Characters
object in which all of HTML character entity references in the
original string have been translated into their Unicode equivalents.public boolean decode(Characters EnStr, StringBuffer Buff)
Characters
object, by translating HTML character entity references into
corresponding Unicode characters.
EnStr
- The string to be decoded.Buff
- A StringBuffer
to which the output of this method is to be appended. The
buffer is not cleared.
true
if any characters were decoded, false
if no characters
were decoded.public boolean decode(Characters EnStr, StringBuilder Buff)
Characters
object, by translating HTML character entity references into
corresponding Unicode characters.
EnStr
- The string to be decoded.Buff
- A StringBuffer
to which the output of this method is to be appended. The
buffer is not cleared.
true
if any characters were decoded, false
if no characters
were decoded.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |