Class HtmlEncoder

java.lang.Object
com.lowagie.text.html.HtmlEncoder

@Deprecated(since="2.1.0") public final class HtmlEncoder extends Object
Deprecated.
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 &quot;
    • & becomes &amp;
    • < becomes &lt;
    • > becomes &gt;
  • 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
    Modifier and Type
    Field
    Description
    private static final String[]
    Deprecated.
    List with the HTML translation of all the characters.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    Deprecated.
    This class will never be constructed.
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    encode(Color color)
    Deprecated.
    Converts a Color into a HTML representation of this Color.
    static String
    encode(String string)
    Deprecated.
    Converts a String to the HTML-format of this String.
    static String
    getAlignment(int alignment)
    Deprecated.
    Translates the alignment value.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • htmlCode

      private static final String[] htmlCode
      Deprecated.
      List with the HTML translation of all the characters.
  • Constructor Details

    • HtmlEncoder

      private HtmlEncoder()
      Deprecated.
      This class will never be constructed.

      HtmlEncoder only contains static methods.

  • Method Details

    • encode

      public static String encode(String string)
      Deprecated.
      Converts a String to the HTML-format of this String.
      Parameters:
      string - The String to convert
      Returns:
      a String
    • encode

      public static String encode(Color color)
      Deprecated.
      Converts a Color into a HTML representation of this Color.
      Parameters:
      color - the Color that has to be converted.
      Returns:
      the HTML representation of this Color
    • getAlignment

      public static String getAlignment(int alignment)
      Deprecated.
      Translates the alignment value.
      Parameters:
      alignment - the alignment value
      Returns:
      the translated value