CharacterEscapes (Jackson-core 2.10.0 API)
Date: 2019-09-25

com.fasterxml.jackson.core.io

## Class CharacterEscapes

- java.lang.Object
- - com.fasterxml.jackson.core.io.CharacterEscapes

- All Implemented Interfaces:
    Serializable
  Direct Known Subclasses:
    JsonpCharacterEscapes

      public abstract class CharacterEscapes
      extends Object
      implements Serializable

  Abstract base class that defines interface for customizing character escaping aspects for String values, for formats that use escaping. For JSON this applies to both property names and String values.
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `ESCAPE_CUSTOM` Value used for lookup tables to indicate that matching characters will need custom escapes; and that another call to `getEscapeSequence(int)` is needed to figure out exact escape sequence to output.
    `static int` | `ESCAPE_NONE` Value used for lookup tables to indicate that matching characters do not need to be escaped.
    `static int` | `ESCAPE_STANDARD` Value used for lookup tables to indicate that matching characters are to be escaped using standard escaping; for JSON this means (for example) using "backslash - u" escape method.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CharacterEscapes()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract int[]` | `getEscapeCodesForAscii()` Method generators can call to get lookup table for determining escape handling for first 128 characters of Unicode (ASCII characters.
    `abstract SerializableString` | `getEscapeSequence(int ch)` Method generators can call to get lookup table for determining exact escape sequence to use for given character.
    `static int[]` | `standardAsciiEscapesForJSON()` Helper method that can be used to get a copy of standard JSON escape definitions; this is useful when just wanting to slightly customize definitions.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### ESCAPE_NONE

          public static final int ESCAPE_NONE

      Value used for lookup tables to indicate that matching characters do not need to be escaped.
      See Also:
        Constant Field Values

    - #### ESCAPE_STANDARD

          public static final int ESCAPE_STANDARD

      Value used for lookup tables to indicate that matching characters are to be escaped using standard escaping; for JSON this means (for example) using "backslash - u" escape method.
      See Also:
        Constant Field Values

    - #### ESCAPE_CUSTOM

          public static final int ESCAPE_CUSTOM

      Value used for lookup tables to indicate that matching characters will need custom escapes; and that another call to `getEscapeSequence(int)` is needed to figure out exact escape sequence to output.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### CharacterEscapes

          public CharacterEscapes()

  - ### Method Detail

    - #### getEscapeCodesForAscii

          public abstract int[] getEscapeCodesForAscii()

      Method generators can call to get lookup table for determining escape handling for first 128 characters of Unicode (ASCII characters. Caller is not to modify contents of this array, since this is expected to be a shared copy.
      Returns:
        Array with size of at least 128, where first 128 entries have either one of `ESCAPE_xxx` constants, or non-zero positive integer (meaning of which is data format specific; for JSON it means that combination of backslash and character with that value is to be used) to indicate that specific escape sequence is to be used.

    - #### getEscapeSequence

          public abstract SerializableString getEscapeSequence(int ch)

      Method generators can call to get lookup table for determining exact escape sequence to use for given character. It can be called for any character, but typically is called for either for ASCII characters for which custom escape sequence is needed; or for any non-ASCII character.

    - #### standardAsciiEscapesForJSON

          public static int[] standardAsciiEscapesForJSON()

      Helper method that can be used to get a copy of standard JSON escape definitions; this is useful when just wanting to slightly customize definitions. Caller can modify this array as it sees fit and usually returns modified instance via `getEscapeCodesForAscii()`

Copyright © 2008–2019 FasterXML. All rights reserved.