Class ArrayBasedEscaperMap


  • public final class ArrayBasedEscaperMap
    extends java.lang.Object
    An implementation-specific parameter class suitable for initializing ArrayBasedCharEscaper or ArrayBasedUnicodeEscaper instances. This class should be used when more than one escaper is created using the same character replacement mapping to allow the underlying (implementation specific) data structures to be shared.

    The size of the data structure used by ArrayBasedCharEscaper and ArrayBasedUnicodeEscaper is proportional to the highest valued character that has a replacement. For example a replacement map containing the single character '\u1000' will require approximately 16K of memory. As such sharing this data structure between escaper instances is the primary goal of this class.

    Since:
    15.0
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private ArrayBasedEscaperMap​(char[][] replacementArray)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static ArrayBasedEscaperMap create​(java.util.Map<java.lang.Character,​java.lang.String> replacements)
      Returns a new ArrayBasedEscaperMap for creating ArrayBasedCharEscaper or ArrayBasedUnicodeEscaper instances.
      (package private) static char[][] createReplacementArray​(java.util.Map<java.lang.Character,​java.lang.String> map)  
      (package private) char[][] getReplacementArray()  
      • Methods inherited from class java.lang.Object

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

      • replacementArray

        private final char[][] replacementArray
      • EMPTY_REPLACEMENT_ARRAY

        private static final char[][] EMPTY_REPLACEMENT_ARRAY
    • Constructor Detail

      • ArrayBasedEscaperMap

        private ArrayBasedEscaperMap​(char[][] replacementArray)
    • Method Detail

      • create

        public static ArrayBasedEscaperMap create​(java.util.Map<java.lang.Character,​java.lang.String> replacements)
        Returns a new ArrayBasedEscaperMap for creating ArrayBasedCharEscaper or ArrayBasedUnicodeEscaper instances.
        Parameters:
        replacements - a map of characters to their escaped representations
      • getReplacementArray

        char[][] getReplacementArray()
      • createReplacementArray

        static char[][] createReplacementArray​(java.util.Map<java.lang.Character,​java.lang.String> map)