Class HtmlEncoder


  • @Deprecated
    public final class HtmlEncoder
    extends java.lang.Object
    Deprecated.
    since 5.5.2
    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 java.lang.String[] HTML_CODE
      Deprecated.
      List with the HTML translation of all the characters.
      private static java.util.Set<java.lang.String> NEWLINETAGS
      Deprecated.
      Set containing tags that trigger a new line.
    • Constructor Summary

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

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static java.lang.String encode​(BaseColor color)
      Deprecated.
      Converts a BaseColor into a HTML representation of this BaseColor.
      static java.lang.String encode​(java.lang.String string)
      Deprecated.
      Converts a String to the HTML-format of this String.
      static java.lang.String getAlignment​(int alignment)
      Deprecated.
      Translates the alignment value.
      static boolean isNewLineTag​(java.lang.String tag)
      Deprecated.
      Returns true if the tag causes a new line like p, br etc.
      • Methods inherited from class java.lang.Object

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

      • HTML_CODE

        private static final java.lang.String[] HTML_CODE
        Deprecated.
        List with the HTML translation of all the characters.
        Since:
        5.0.6 (renamed from htmlCode)
      • NEWLINETAGS

        private static final java.util.Set<java.lang.String> NEWLINETAGS
        Deprecated.
        Set containing tags that trigger a new line.
        Since:
        iText 5.0.6
    • Constructor Detail

      • HtmlEncoder

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

      • encode

        public static java.lang.String encode​(java.lang.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 java.lang.String encode​(BaseColor color)
        Deprecated.
        Converts a BaseColor into a HTML representation of this BaseColor.
        Parameters:
        color - the BaseColor that has to be converted.
        Returns:
        the HTML representation of this BaseColor
      • getAlignment

        public static java.lang.String getAlignment​(int alignment)
        Deprecated.
        Translates the alignment value.
        Parameters:
        alignment - the alignment value
        Returns:
        the translated value
      • isNewLineTag

        public static boolean isNewLineTag​(java.lang.String tag)
        Deprecated.
        Returns true if the tag causes a new line like p, br etc.
        Since:
        iText 5.0.6