Top Description Fields Constructors Methods
com.fasterxml.jackson.core.io

public abstract Class CharacterEscapes

extends Object
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Known Direct Subclasses
com.fasterxml.jackson.core.JsonpCharacterEscapes
Annotations
@SuppressWarnings:serial
Imports
java.util.Arrays, com.fasterxml.jackson.core.SerializableString

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.

Field Summary

Modifier and TypeField and Description
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 is needed to figure out exact escape sequence to output.

public static final int
ESCAPE_NONE

Value used for lookup tables to indicate that matching characters do not need to be escaped.

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.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public abstract int[]

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.
getEscapeCodesForAscii
()

Method generators can call to get lookup table for determining escape handling for first 128 characters of Unicode (ASCII characters.

public abstract SerializableString

Returns:

Escape sequence to use for the character, if any; null if not
getEscapeSequence
(int
Character to look escape sequence for
ch
)

Method generators can call to get lookup table for determining exact escape sequence to use for given character.

public static int[]

Returns:

Set of escapes, similar to getEscapeCodesForAscii() (array of 128 ints), but a copy that caller owns and is free to modify
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.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ESCAPE_CUSTOMback to summary
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 is needed to figure out exact escape sequence to output.

ESCAPE_NONEback to summary
public static final int ESCAPE_NONE

Value used for lookup tables to indicate that matching characters do not need to be escaped.

ESCAPE_STANDARDback to summary
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.

Constructor Detail

CharacterEscapesback to summary
public CharacterEscapes()

Method Detail

getEscapeCodesForAsciiback to summary
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:int[]

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.

getEscapeSequenceback to summary
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.

Parameters
ch:int

Character to look escape sequence for

Returns:SerializableString

Escape sequence to use for the character, if any; null if not

standardAsciiEscapesForJSONback to summary
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

Returns:int[]

Set of escapes, similar to getEscapeCodesForAscii() (array of 128 ints), but a copy that caller owns and is free to modify