Package com.lowagie.text.html
Class HtmlEncoder
java.lang.Object
com.lowagie.text.html.HtmlEncoder
This class converts a
String
to the HTML-format of a String.
To convert the String
, each character is examined:
- ASCII-characters from 000 till 031 are represented as &#xxx;
(with xxx = the value of the character) - ASCII-characters from 032 t/m 127 are represented by the character itself, except for:
- '\n' becomes <BR>\n
- " becomes "
- & becomes &
- < becomes <
- > becomes >
- ASCII-characters from 128 till 255 are represented as &#xxx;
(with xxx = the value of the character)
Example:
String htmlPresentation = HtmlEncoder.encode("Marie-Thérèse Sørensen");
for more info: see O'Reilly; "HTML: The Definitive Guide" (page 164)
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
htmlCode
List with the HTML translation of all the characters.
-
-
Constructor Details
-
HtmlEncoder
private HtmlEncoder()This class will never be constructed.HtmlEncoder only contains static methods.
-
-
Method Details
-
encode
Converts aString
to the HTML-format of thisString
.- Parameters:
string
- TheString
to convert- Returns:
- a
String
-
encode
Converts aColor
into a HTML representation of thisColor
.- Parameters:
color
- theColor
that has to be converted.- Returns:
- the HTML representation of this
Color
-
getAlignment
Translates the alignment value.- Parameters:
alignment
- the alignment value- Returns:
- the translated value
-