com.fasterxml.jackson.core

Class 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
    • Constructor Detail

      • JsonpCharacterEscapes

        public JsonpCharacterEscapes()
    • Method Detail

      • 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–2017 FasterXML. All rights reserved.