Top Description Fields Constructors Methods
com.google.common.escape

public final Class ArrayBasedEscaperMap

extends Object
Class Inheritance
Annotations
@GwtCompatible
@ElementTypesAreNonnullByDefault
Static Imports
com.google.common.base.Preconditions.checkNotNull

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.

Author
David Beaumont
Since
15.0

Field Summary

Modifier and TypeField and Description
private static final char[][]
private final char[][]

Constructor Summary

AccessConstructor and Description
private
ArrayBasedEscaperMap(char[][] replacementArray)

Method Summary

Modifier and TypeMethod and Description
public static ArrayBasedEscaperMap
create(Map<Character, String>
a map of characters to their escaped representations
replacements
)

Returns a new ArrayBasedEscaperMap for creating ArrayBasedCharEscaper or ArrayBasedUnicodeEscaper instances.

pack-priv static char[][]
pack-priv char[][]
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

EMPTY_REPLACEMENT_ARRAYback to summary
private static final char[][] EMPTY_REPLACEMENT_ARRAY
replacementArrayback to summary
private final char[][] replacementArray

Constructor Detail

ArrayBasedEscaperMapback to summary
private ArrayBasedEscaperMap(char[][] replacementArray)

Method Detail

createback to summary
public static ArrayBasedEscaperMap create(Map<Character, String> replacements)

Returns a new ArrayBasedEscaperMap for creating ArrayBasedCharEscaper or ArrayBasedUnicodeEscaper instances.

Parameters
replacements:Map<Character, String>

a map of characters to their escaped representations

createReplacementArrayback to summary
pack-priv static char[][] createReplacementArray(Map<Character, String> map)
Annotations
@VisibleForTesting
getReplacementArrayback to summary
pack-priv char[][] getReplacementArray()