Class CharacterMap


  • public class CharacterMap
    extends java.lang.Object
    This class defines a character map, that is, a mapping from characters to strings used by the serializer when mapping individual characters in the output.
    • Constructor Summary

      Constructors 
      Constructor Description
      CharacterMap​(java.lang.Iterable<CharacterMap> list)
      Create a CharacterMap that combines a set of existing character maps.
      CharacterMap​(StructuredQName name, IntHashMap<java.lang.String> map)
      Create a CharacterMap from a raw map of integers to strings
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void export​(ExpressionPresenter out)
      Write the character map to an export file
      StructuredQName getName()
      Get the name of the character map
      java.lang.CharSequence map​(java.lang.CharSequence in, boolean insertNulls)
      Expand all the characters in a string using this character mapping
      • Methods inherited from class java.lang.Object

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

      • CharacterMap

        public CharacterMap​(StructuredQName name,
                            IntHashMap<java.lang.String> map)
        Create a CharacterMap from a raw map of integers to strings
        Parameters:
        map - the mapping of integer Unicode character codes to strings. This must not be subsequently changed.
      • CharacterMap

        public CharacterMap​(java.lang.Iterable<CharacterMap> list)
        Create a CharacterMap that combines a set of existing character maps.
        Parameters:
        list - the list of existing character maps. If the same character is mapped by more than one map in the list, the last mapping takes precedence
    • Method Detail

      • getName

        public StructuredQName getName()
        Get the name of the character map
        Returns:
        the name given in the stylesheet if this is an un-expanded character map, or null if this is an expanded map (a map combined with the character maps that it references)
      • map

        public java.lang.CharSequence map​(java.lang.CharSequence in,
                                          boolean insertNulls)
        Expand all the characters in a string using this character mapping
        Parameters:
        in - the input string to be mapped
        insertNulls - true if null (0) characters are to be inserted before and after replacement characters. This is done to signal that output escaping of these characters is disabled. The flag is set to true when writing XML or HTML, but to false when writing TEXT.
      • export

        public void export​(ExpressionPresenter out)
        Write the character map to an export file
        Parameters:
        out - the output destination