Class EntityMap


  • public class EntityMap
    extends java.lang.Object
    Maps HTML entities and named character references to their Java equivalent.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static java.lang.String[] entityKeys  
      protected static java.lang.String[] entityReplacements  
      protected static java.util.HashMap<java.lang.String,​java.lang.String> map  
      protected static java.util.List<java.util.regex.Pattern> patterns  
    • Constructor Summary

      Constructors 
      Constructor Description
      EntityMap()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String get​(java.lang.String key)
      Returns tne Java equivalent of an entity or a named character reference.
      protected static java.lang.String getNextEntity​(java.lang.String source, int regionStart)
      Search a string for the next occurrence of an entity.
      static java.lang.String replaceAll​(java.lang.String source)
      Replaces all entities and character references in a specified string.
      • Methods inherited from class java.lang.Object

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

      • patterns

        protected static final java.util.List<java.util.regex.Pattern> patterns
      • map

        protected static final java.util.HashMap<java.lang.String,​java.lang.String> map
      • entityKeys

        protected static java.lang.String[] entityKeys
      • entityReplacements

        protected static final java.lang.String[] entityReplacements
    • Constructor Detail

      • EntityMap

        public EntityMap()
    • Method Detail

      • replaceAll

        public static java.lang.String replaceAll​(java.lang.String source)
        Replaces all entities and character references in a specified string.
        Parameters:
        source - the input string.
        Returns:
        the input string with all entities and references resolved. The input string is returned as-is if it contains no entities or references.
      • getNextEntity

        protected static java.lang.String getNextEntity​(java.lang.String source,
                                                        int regionStart)
        Search a string for the next occurrence of an entity.
        Parameters:
        source - String to search.
        regionStart - Position in the string at which to start searching.
        Returns:
        The entity that was matched, or null if no entity could be matched.
      • get

        public static java.lang.String get​(java.lang.String key)
        Returns tne Java equivalent of an entity or a named character reference.
        Parameters:
        key - the entity or character reference.
        Returns:
        the Java equivalent of the input, or null if the input string does not identify a known entity or character reference.