| Modifier and Type | Class and Description |
|---|---|
| private static class | CharEscaperBuilder.
Simple decorator that turns an array of replacement char[]s into a CharEscaper, this results in a very fast escape method. |
| Modifier and Type | Field and Description |
|---|---|
| private final Map | |
| private int |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public CharEscaperBuilder | |
| public CharEscaperBuilder | |
| public @Nullable char[][] | Returns: a "sparse" array that holds the replacement mappings.Convert this builder into an array of char[]s where the maximum index is the value of the highest character that has been seen. |
| public Escaper | Returns: an escaper that escapes based on the underlying array.Convert this builder into a char escaper which is just a decorator around the underlying array of replacement char[]s. |
| map | back to summary |
|---|---|
| private final Map<Character, String> map | |
| max | back to summary |
|---|---|
| private int max | |
| CharEscaperBuilder | back to summary |
|---|---|
| public CharEscaperBuilder() Construct a new sparse array builder. | |
| addEscape | back to summary |
|---|---|
| public CharEscaperBuilder addEscape(char c, String r) Add a new mapping from an index to an object to the escaping.
| |
| addEscapes | back to summary |
|---|---|
| public CharEscaperBuilder addEscapes(char[] cs, String r) Add multiple mappings at once for a particular index.
| |
| toArray | back to summary |
|---|---|
| public @Nullable char[][] toArray() Convert this builder into an array of char[]s where the maximum index is the value of the highest character that has been seen. The array will be sparse in the sense that any unseen index will default to null.
| |
| toEscaper | back to summary |
|---|---|
| public Escaper toEscaper() Convert this builder into a char escaper which is just a decorator around the underlying array of replacement char[]s.
| |
| Modifier and Type | Field and Description |
|---|---|
| private final int | |
| private final @Nullable char[][] |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public String | escape(String
the literal string to be escaped s)Overrides com. |
| protected char[] | escape(char
the character to escape if necessary c)Implements abstract com. null if this character does not
need to be escaped.
|
| replaceLength | back to summary |
|---|---|
| private final int replaceLength | |
| replacements | back to summary |
|---|---|
| private final @Nullable char[][] replacements | |
| CharArrayDecorator | back to summary |
|---|---|
| pack-priv CharArrayDecorator(@Nullable char[][] replacements) | |
| escape | back to summary |
|---|---|
| public String escape(String s) Overrides com. Doc from com. Returns the escaped form of a given literal string. | |
| escape | back to summary |
|---|---|
| protected char[] escape(char c) Implements abstract com. Doc from com. Returns the escaped form of the given character, or If the character does not need to be escaped, this method should return An escaper is expected to be able to deal with any
| |