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

public final Class CharTypes

extends Object
Class Inheritance
Imports
java.util.Arrays

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
CharTypes.AltEscapes

Helper used for lazy initialization of alternative escape (quoting) table, used for escaping content that uses non-standard quote character (usually apostrophe).

Field Summary

Modifier and TypeField and Description
protected static final byte[]
protected static final byte[]
protected static final char[]
protected static final char[]
protected static final int[]
sHexValues

Lookup table for the first 256 Unicode characters (ASCII / UTF-8) range.

protected static final int[]
sInputCodes

Lookup table used for determining which input characters need special handling when contained in text segment.

protected static final int[]
sInputCodesComment

Decoding table used to quickly determine characters that are relevant within comment content.

protected static final int[]
sInputCodesJsNames

To support non-default (and -standard) unquoted field names mode, need to have alternate checking.

protected static final int[]
sInputCodesUTF8

Additionally we can combine UTF-8 decoding info into similar data table.

protected static final int[]
sInputCodesUtf8JsNames

This table is similar to Latin-1, except that it marks all "high-bit" code as ok.

protected static final int[]
sInputCodesWS

Decoding table used for skipping white space and comments.

protected static final int[]
sOutputEscapes128

Lookup table used for determining which output characters in 7-bit ASCII range need to be quoted.

protected static final int[]
sOutputEscapes128WithSlash

Lookup table same as sOutputEscapes128 except that forward slash ('/') is also escaped

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static void
appendQuoted(StringBuilder
Buffer to append escaped contents in
sb
,
String
Unescaped String value to append with escaping applied
content
)

Helper method for appending JSON-escaped version of contents into specific StringBuilder, using default JSON specification mandated minimum escaping rules.

public static int
charToHex(int ch)

public static byte[]

Returns:

Copy of array of 16 upper-case hexadecimal characters as bytes
copyHexBytes
()
Deprecated Since 2.14 Use copyHexBytes(boolean) instead

public static byte[]
copyHexBytes(boolean uppercase)

public static char[]

Returns:

Copy of array of 16 upper-case hexadecimal characters
copyHexChars
()
Deprecated Since 2.14 Use copyHexChars(boolean) instead

public static char[]
copyHexChars(boolean uppercase)

public static int[]

Returns:

128-entry int[] that contains escape definitions
get7BitOutputEscapes
()

Accessor for getting a read-only encoding table for first 128 Unicode code points (single-byte UTF-8 characters).

public static int[]

Returns:

128-entry int[] that contains escape definitions
get7BitOutputEscapes
(int
Character used for quoting textual values and property names; usually double-quote but sometimes changed to single-quote (apostrophe)
quoteChar
)

Alternative to get7BitOutputEscapes() when a non-standard quote character is used.

public static int[]

Returns:

128-entry int[] that contains escape definitions
get7BitOutputEscapes
(int
Character used for quoting textual values and property names; usually double-quote but sometimes changed to single-quote (apostrophe)
quoteChar
,
boolean escapeSlash)

Alternative to get7BitOutputEscapes() when either a non-standard quote character is used, or forward slash is to be escaped.

public static int[]
public static int[]
public static int[]
public static int[]
public static int[]
public static int[]
public static char
hexToChar(int ch)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

HBback to summary
protected static final byte[] HB
HBlowerback to summary
protected static final byte[] HBlower
HCback to summary
protected static final char[] HC
HClowerback to summary
protected static final char[] HClower
sHexValuesback to summary
protected static final int[] sHexValues

Lookup table for the first 256 Unicode characters (ASCII / UTF-8) range. For actual hex digits, contains corresponding value; for others -1.

Note

before 2.10.1, was of size 128, extended for simpler handling

sInputCodesback to summary
protected static final int[] sInputCodes

Lookup table used for determining which input characters need special handling when contained in text segment.

sInputCodesCommentback to summary
protected static final int[] sInputCodesComment

Decoding table used to quickly determine characters that are relevant within comment content.

sInputCodesJsNamesback to summary
protected static final int[] sInputCodesJsNames

To support non-default (and -standard) unquoted field names mode, need to have alternate checking. Basically this is list of 8-bit ASCII characters that are legal as part of Javascript identifier

sInputCodesUTF8back to summary
protected static final int[] sInputCodesUTF8

Additionally we can combine UTF-8 decoding info into similar data table.

sInputCodesUtf8JsNamesback to summary
protected static final int[] sInputCodesUtf8JsNames

This table is similar to Latin-1, except that it marks all "high-bit" code as ok. They will be validated at a later point, when decoding name

sInputCodesWSback to summary
protected static final int[] sInputCodesWS

Decoding table used for skipping white space and comments.

Since
2.3
sOutputEscapes128back to summary
protected static final int[] sOutputEscapes128

Lookup table used for determining which output characters in 7-bit ASCII range need to be quoted.

sOutputEscapes128WithSlashback to summary
protected static final int[] sOutputEscapes128WithSlash

Lookup table same as sOutputEscapes128 except that forward slash ('/') is also escaped

Constructor Detail

CharTypesback to summary
public CharTypes()

Method Detail

appendQuotedback to summary
public static void appendQuoted(StringBuilder sb, String content)

Helper method for appending JSON-escaped version of contents into specific StringBuilder, using default JSON specification mandated minimum escaping rules.

Parameters
sb:StringBuilder

Buffer to append escaped contents in

content:String

Unescaped String value to append with escaping applied

charToHexback to summary
public static int charToHex(int ch)
copyHexBytesback to summary
public static byte[] copyHexBytes()

Deprecated

Since 2.14 Use copyHexBytes(boolean) instead

Returns:byte[]

Copy of array of 16 upper-case hexadecimal characters as bytes

Annotations
@Deprecated
copyHexBytesback to summary
public static byte[] copyHexBytes(boolean uppercase)
copyHexCharsback to summary
public static char[] copyHexChars()

Deprecated

Since 2.14 Use copyHexChars(boolean) instead

Returns:char[]

Copy of array of 16 upper-case hexadecimal characters

Annotations
@Deprecated
copyHexCharsback to summary
public static char[] copyHexChars(boolean uppercase)
get7BitOutputEscapesback to summary
public static int[] get7BitOutputEscapes()

Accessor for getting a read-only encoding table for first 128 Unicode code points (single-byte UTF-8 characters). Value of 0 means "no escaping"; other positive values that value is character to use after backslash; and negative values that generic (backslash - u) escaping is to be used.

Returns:int[]

128-entry int[] that contains escape definitions

get7BitOutputEscapesback to summary
public static int[] get7BitOutputEscapes(int quoteChar)

Alternative to get7BitOutputEscapes() when a non-standard quote character is used.

Parameters
quoteChar:int

Character used for quoting textual values and property names; usually double-quote but sometimes changed to single-quote (apostrophe)

Returns:int[]

128-entry int[] that contains escape definitions

Since
2.10
get7BitOutputEscapesback to summary
public static int[] get7BitOutputEscapes(int quoteChar, boolean escapeSlash)

Alternative to get7BitOutputEscapes() when either a non-standard quote character is used, or forward slash is to be escaped.

Parameters
quoteChar:int

Character used for quoting textual values and property names; usually double-quote but sometimes changed to single-quote (apostrophe)

Returns:int[]

128-entry int[] that contains escape definitions

Since
2.17
getInputCodeCommentback to summary
public static int[] getInputCodeComment()
getInputCodeLatin1back to summary
public static int[] getInputCodeLatin1()
getInputCodeLatin1JsNamesback to summary
public static int[] getInputCodeLatin1JsNames()
getInputCodeUtf8back to summary
public static int[] getInputCodeUtf8()
getInputCodeUtf8JsNamesback to summary
public static int[] getInputCodeUtf8JsNames()
getInputCodeWSback to summary
public static int[] getInputCodeWS()
hexToCharback to summary
public static char hexToChar(int ch)
com.fasterxml.jackson.core.io back to summary

private Class CharTypes.AltEscapes

extends Object
Class Inheritance

Helper used for lazy initialization of alternative escape (quoting) table, used for escaping content that uses non-standard quote character (usually apostrophe).
Since
2.10

Field Summary

Modifier and TypeField and Description
private int[][]
private int[][]
public static final CharTypes.AltEscapes

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public int[]
escapesFor(int quoteChar)

public int[]
escapesFor(int quoteChar, boolean escapeSlash)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_altEscapesback to summary
private int[][] _altEscapes
_altEscapesWithSlashback to summary
private int[][] _altEscapesWithSlash
instanceback to summary
public static final CharTypes.AltEscapes instance

Constructor Detail

AltEscapesback to summary
private AltEscapes()

Method Detail

escapesForback to summary
public int[] escapesFor(int quoteChar)
escapesForback to summary
public int[] escapesFor(int quoteChar, boolean escapeSlash)