com.fasterxml.jackson.core

## Class JsonpCharacterEscapes

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

- All Implemented Interfaces:
    Serializable

      public class JsonpCharacterEscapes
      extends CharacterEscapes

  Convenience `CharacterEscapes` implementation that escapes Unicode characters `0x2028` and `0x2029` (in addition to characters escaped otherwise), which are apparently considered linefeeds as per newer Javascript specifications, and consequently problematic when using JSONP (see https://en.wikipedia.org/wiki/JSONP).
  Since:
    2.8
  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from class com.fasterxml.jackson.core.io.CharacterEscapes

      `ESCAPE_CUSTOM, ESCAPE_NONE, ESCAPE_STANDARD`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JsonpCharacterEscapes()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int[]` | `getEscapeCodesForAscii()` Method generators can call to get lookup table for determining escape handling for first 128 characters of Unicode (ASCII characters.
    `SerializableString` | `getEscapeSequence(int ch)` Method generators can call to get lookup table for determining exact escape sequence to use for given character.
    `static JsonpCharacterEscapes` | `instance()`

    - ### Methods inherited from class com.fasterxml.jackson.core.io.CharacterEscapes

      `standardAsciiEscapesForJSON`

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

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

- - ### Constructor Detail

    - #### JsonpCharacterEscapes

          public JsonpCharacterEscapes()

  - ### Method Detail

    - #### instance

          public static JsonpCharacterEscapes instance()

    - #### getEscapeSequence

          public SerializableString getEscapeSequence(int ch)

      Description copied from class: `CharacterEscapes`
      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.
      Specified by:
        `getEscapeSequence` in class `CharacterEscapes`

    - #### getEscapeCodesForAscii

          public int[] getEscapeCodesForAscii()

      Description copied from class: `CharacterEscapes`
      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.
      Specified by:
        `getEscapeCodesForAscii` in class `CharacterEscapes`
      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.

Copyright © 2008–2018 FasterXML. All rights reserved.