Top Description Fields Constructors Methods
com.fasterxml.jackson.dataformat.smile

public final Class SmileConstants

extends Object
Class Inheritance

Constants used by SmileGenerator and SmileParser
Author
tatu

Field Summary

Modifier and TypeField and Description
public static final byte
BYTE_MARKER_END_OF_CONTENT

In addition we can use a marker to allow simple framing; splitting of physical data (like file) into distinct logical sections like JSON documents.

public static final byte
public static final int
HEADER_BIT_HAS_RAW_BINARY

Indicator bit that indicates whether encoded content may contain raw (unquoted) binary values.

public static final int
HEADER_BIT_HAS_SHARED_NAMES

Indicator bit that indicates whether encoded content may have Shared names (back references to recently encoded field names).

public static final int
HEADER_BIT_HAS_SHARED_STRING_VALUES

Indicator bit that indicates whether encoded content may have shared String values (back references to recently encoded 'short' String values, where short is defined as 64 bytes or less).

public static final byte
HEADER_BYTE_1

First byte of data header (0x3A)

public static final byte
HEADER_BYTE_2

Second byte of data header (0x29)

public static final byte
HEADER_BYTE_3

Third byte of data header

public static final byte
HEADER_BYTE_4

Fourth byte of data header; contains version nibble, may have flags

public static final int
HEADER_VERSION_0

Current version consists of four zero bits (nibble)

public static final int
INT_MARKER_END_OF_STRING

We need a byte marker to denote end of variable-length Strings.

public static final int
public static final int
public static final int
MAX_SHARED_NAMES

Longest back reference we use for field names is 10 bits; no point in keeping much more around

public static final int
MAX_SHARED_STRING_LENGTH_BYTES

Also: whereas we can refer to names of any length, we will only consider text values that are considered "tiny" or "short" (ones encoded with length prefix); this value thereby has to be maximum length of Strings that can be encoded as such.

public static final int
MAX_SHARED_STRING_VALUES

Longest back reference we use for short shared String values is 10 bits, so up to (1 << 10) values to keep track of.

public static final int
MAX_SHORT_NAME_ANY_BYTES

Regardless of ASCII/non-ASCII aspect, maximum byte length for any short name is then 64 bytes.

public static final int
MAX_SHORT_NAME_ASCII_BYTES

Maximum byte length for short ASCII names is 64.

public static final int
MAX_SHORT_NAME_UNICODE_BYTES

Maximum byte length for short non-ASCII names is slightly less due to having to reserve bytes 0xF8 and above (but we get one more as values 0 and 1 are not valid)

public static final int
MAX_SHORT_VALUE_STRING_BYTES

Encoding has special "short" forms for value Strings that can be represented by 64 bytes of UTF-8 or less.

public static final int
MIN_BUFFER_FOR_POSSIBLE_SHORT_STRING

And to make encoding logic tight and simple, we can always require that output buffer has this amount of space available before encoding possibly short String (3 bytes since longest UTF-8 encoded Java char is 3 bytes).

public static final int[]
sUtf8UnitLengths

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

public static final byte
TOKEN_KEY_EMPTY_STRING

Let's use same code for empty key as for empty String value

public static final byte
public static final byte
public static final byte
public static final byte
public static final byte
public static final byte
public static final byte
public static final byte
public static final byte
public static final byte
TOKEN_MISC_BINARY_7BIT

Type (for misc, other) used for "safe" (encoded by only using 7 LSB, giving 8/7 expansion ratio).

public static final byte
TOKEN_MISC_BINARY_RAW

Raw binary data marker is specifically chosen as separate from other types, since it can have significant impact on framing (or rather fast scanning based on structure and framing markers).

public static final int
TOKEN_MISC_FLOAT_32

Numeric subtype (2 LSB) for indicating 32-bit IEEE single precision floating point number.

public static final int
TOKEN_MISC_FLOAT_64

Numeric subtype (2 LSB) indicating 64-bit IEEE double precision floating point number.

public static final int
TOKEN_MISC_FLOAT_BIG

Numeric subtype (2 LSB) for indicating java.math.BigDecimal type.

public static final int
TOKEN_MISC_INTEGER_32

Numeric subtype (2 LSB) indicating 32-bit integer (int)

public static final int
TOKEN_MISC_INTEGER_64

Numeric subtype (2 LSB) indicating 32-bit integer (long)

public static final int
TOKEN_MISC_INTEGER_BIG

Numeric subtype (2 LSB) for indicating java.math.BigInteger type.

public static final byte
TOKEN_MISC_LONG_TEXT_ASCII

Type (for misc, other) used for variable length UTF-8 encoded text, when it is known to only contain ASCII chars.

public static final byte
TOKEN_MISC_LONG_TEXT_UNICODE

Type (for misc, other) used for variable length UTF-8 encoded text, when it is NOT known to only contain ASCII chars (which means it MAY have multi-byte characters) Note: 2 LSB are reserved for future use; must be zeroes for now

public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

BYTE_MARKER_END_OF_CONTENTback to summary
public static final byte BYTE_MARKER_END_OF_CONTENT

In addition we can use a marker to allow simple framing; splitting of physical data (like file) into distinct logical sections like JSON documents. 0xFF makes sense here since it is also used as end marker for Web Sockets.

BYTE_MARKER_END_OF_STRINGback to summary
public static final byte BYTE_MARKER_END_OF_STRING
HEADER_BIT_HAS_RAW_BINARYback to summary
public static final int HEADER_BIT_HAS_RAW_BINARY

Indicator bit that indicates whether encoded content may contain raw (unquoted) binary values. If no header available, can be assumed to be 0 (false). If header exists, and bit value is 1, parser can not assume that specific byte values always have default meaning (specifically, content end marker 0xFF and header signature can be contained in binary values)

Note that this bit being true does not automatically mean that such raw binary content indeed exists; just that it may exist. This because header is written before any binary data may be written.

HEADER_BIT_HAS_SHARED_NAMESback to summary
public static final int HEADER_BIT_HAS_SHARED_NAMES

Indicator bit that indicates whether encoded content may have Shared names (back references to recently encoded field names). If no header available, must be processed as if this was set to true. If (and only if) header exists, and value is 0, can parser omit storing of seen names, as it is guaranteed that no back references exist.

HEADER_BIT_HAS_SHARED_STRING_VALUESback to summary
public static final int HEADER_BIT_HAS_SHARED_STRING_VALUES

Indicator bit that indicates whether encoded content may have shared String values (back references to recently encoded 'short' String values, where short is defined as 64 bytes or less). If no header available, can be assumed to be 0 (false). If header exists, and bit value is 1, parsers has to store up to 1024 most recently seen distinct short String values.

HEADER_BYTE_1back to summary
public static final byte HEADER_BYTE_1

First byte of data header (0x3A)

HEADER_BYTE_2back to summary
public static final byte HEADER_BYTE_2

Second byte of data header (0x29)

HEADER_BYTE_3back to summary
public static final byte HEADER_BYTE_3

Third byte of data header

HEADER_BYTE_4back to summary
public static final byte HEADER_BYTE_4

Fourth byte of data header; contains version nibble, may have flags

HEADER_VERSION_0back to summary
public static final int HEADER_VERSION_0

Current version consists of four zero bits (nibble)

INT_MARKER_END_OF_STRINGback to summary
public static final int INT_MARKER_END_OF_STRING

We need a byte marker to denote end of variable-length Strings. Although null byte is commonly used, let's try to avoid using it since it can't be embedded in Web Sockets content (similarly, 0xFF can't). There are multiple candidates for bytes UTF-8 can not have; 0xFC is chosen to allow reasonable ordering (highest values meaning most significant framing function; 0xFF being end-of-content and so on)

INT_MISC_BINARY_7BITback to summary
public static final int INT_MISC_BINARY_7BIT
INT_MISC_BINARY_RAWback to summary
public static final int INT_MISC_BINARY_RAW
MAX_SHARED_NAMESback to summary
public static final int MAX_SHARED_NAMES

Longest back reference we use for field names is 10 bits; no point in keeping much more around

MAX_SHARED_STRING_LENGTH_BYTESback to summary
public static final int MAX_SHARED_STRING_LENGTH_BYTES

Also: whereas we can refer to names of any length, we will only consider text values that are considered "tiny" or "short" (ones encoded with length prefix); this value thereby has to be maximum length of Strings that can be encoded as such.

MAX_SHARED_STRING_VALUESback to summary
public static final int MAX_SHARED_STRING_VALUES

Longest back reference we use for short shared String values is 10 bits, so up to (1 << 10) values to keep track of.

MAX_SHORT_NAME_ANY_BYTESback to summary
public static final int MAX_SHORT_NAME_ANY_BYTES

Regardless of ASCII/non-ASCII aspect, maximum byte length for any short name is then 64 bytes.

MAX_SHORT_NAME_ASCII_BYTESback to summary
public static final int MAX_SHORT_NAME_ASCII_BYTES

Maximum byte length for short ASCII names is 64.

MAX_SHORT_NAME_UNICODE_BYTESback to summary
public static final int MAX_SHORT_NAME_UNICODE_BYTES

Maximum byte length for short non-ASCII names is slightly less due to having to reserve bytes 0xF8 and above (but we get one more as values 0 and 1 are not valid)

MAX_SHORT_VALUE_STRING_BYTESback to summary
public static final int MAX_SHORT_VALUE_STRING_BYTES

Encoding has special "short" forms for value Strings that can be represented by 64 bytes of UTF-8 or less.

MIN_BUFFER_FOR_POSSIBLE_SHORT_STRINGback to summary
public static final int MIN_BUFFER_FOR_POSSIBLE_SHORT_STRING

And to make encoding logic tight and simple, we can always require that output buffer has this amount of space available before encoding possibly short String (3 bytes since longest UTF-8 encoded Java char is 3 bytes). Two extra bytes need to be reserved as well; first for token indicator, and second for terminating null byte (in case it's not a short String after all)

sUtf8UnitLengthsback to summary
public static final int[] sUtf8UnitLengths

Additionally we can combine UTF-8 decoding info into similar data table. Values indicate "byte length - 1"; meaning -1 is used for invalid bytes, 0 for single-byte codes, 1 for 2-byte codes and 2 for 3-byte codes.

TOKEN_KEY_EMPTY_STRINGback to summary
public static final byte TOKEN_KEY_EMPTY_STRING

Let's use same code for empty key as for empty String value

TOKEN_KEY_LONG_STRINGback to summary
public static final byte TOKEN_KEY_LONG_STRING
TOKEN_LITERAL_EMPTY_STRINGback to summary
public static final byte TOKEN_LITERAL_EMPTY_STRING
TOKEN_LITERAL_END_ARRAYback to summary
public static final byte TOKEN_LITERAL_END_ARRAY
TOKEN_LITERAL_END_OBJECTback to summary
public static final byte TOKEN_LITERAL_END_OBJECT
TOKEN_LITERAL_FALSEback to summary
public static final byte TOKEN_LITERAL_FALSE
TOKEN_LITERAL_NULLback to summary
public static final byte TOKEN_LITERAL_NULL
TOKEN_LITERAL_START_ARRAYback to summary
public static final byte TOKEN_LITERAL_START_ARRAY
TOKEN_LITERAL_START_OBJECTback to summary
public static final byte TOKEN_LITERAL_START_OBJECT
TOKEN_LITERAL_TRUEback to summary
public static final byte TOKEN_LITERAL_TRUE
TOKEN_MISC_BINARY_7BITback to summary
public static final byte TOKEN_MISC_BINARY_7BIT

Type (for misc, other) used for "safe" (encoded by only using 7 LSB, giving 8/7 expansion ratio). This is usually done to ensure that certain bytes are never included in encoded data (like 0xFF) Note: 2 LSB are reserved for future use; must be zeroes for now

TOKEN_MISC_BINARY_RAWback to summary
public static final byte TOKEN_MISC_BINARY_RAW

Raw binary data marker is specifically chosen as separate from other types, since it can have significant impact on framing (or rather fast scanning based on structure and framing markers).

TOKEN_MISC_FLOAT_32back to summary
public static final int TOKEN_MISC_FLOAT_32

Numeric subtype (2 LSB) for indicating 32-bit IEEE single precision floating point number.

TOKEN_MISC_FLOAT_64back to summary
public static final int TOKEN_MISC_FLOAT_64

Numeric subtype (2 LSB) indicating 64-bit IEEE double precision floating point number.

TOKEN_MISC_FLOAT_BIGback to summary
public static final int TOKEN_MISC_FLOAT_BIG

Numeric subtype (2 LSB) for indicating java.math.BigDecimal type.

TOKEN_MISC_INTEGER_32back to summary
public static final int TOKEN_MISC_INTEGER_32

Numeric subtype (2 LSB) indicating 32-bit integer (int)

TOKEN_MISC_INTEGER_64back to summary
public static final int TOKEN_MISC_INTEGER_64

Numeric subtype (2 LSB) indicating 32-bit integer (long)

TOKEN_MISC_INTEGER_BIGback to summary
public static final int TOKEN_MISC_INTEGER_BIG

Numeric subtype (2 LSB) for indicating java.math.BigInteger type.

TOKEN_MISC_LONG_TEXT_ASCIIback to summary
public static final byte TOKEN_MISC_LONG_TEXT_ASCII

Type (for misc, other) used for variable length UTF-8 encoded text, when it is known to only contain ASCII chars.

Note

2 LSB are reserved for future use; must be zeroes for now

TOKEN_MISC_LONG_TEXT_UNICODEback to summary
public static final byte TOKEN_MISC_LONG_TEXT_UNICODE

Type (for misc, other) used for variable length UTF-8 encoded text, when it is NOT known to only contain ASCII chars (which means it MAY have multi-byte characters) Note: 2 LSB are reserved for future use; must be zeroes for now

TOKEN_PREFIX_FPback to summary
public static final int TOKEN_PREFIX_FP
TOKEN_PREFIX_INTEGERback to summary
public static final int TOKEN_PREFIX_INTEGER
TOKEN_PREFIX_KEY_ASCIIback to summary
public static final int TOKEN_PREFIX_KEY_ASCII
TOKEN_PREFIX_KEY_SHARED_LONGback to summary
public static final int TOKEN_PREFIX_KEY_SHARED_LONG
TOKEN_PREFIX_KEY_SHARED_SHORTback to summary
public static final int TOKEN_PREFIX_KEY_SHARED_SHORT
TOKEN_PREFIX_KEY_UNICODEback to summary
public static final int TOKEN_PREFIX_KEY_UNICODE
TOKEN_PREFIX_MISC_OTHERback to summary
public static final int TOKEN_PREFIX_MISC_OTHER
TOKEN_PREFIX_SHARED_STRING_LONGback to summary
public static final int TOKEN_PREFIX_SHARED_STRING_LONG
TOKEN_PREFIX_SHARED_STRING_SHORTback to summary
public static final int TOKEN_PREFIX_SHARED_STRING_SHORT
TOKEN_PREFIX_SHORT_UNICODEback to summary
public static final int TOKEN_PREFIX_SHORT_UNICODE
TOKEN_PREFIX_SMALL_ASCIIback to summary
public static final int TOKEN_PREFIX_SMALL_ASCII
TOKEN_PREFIX_SMALL_INTback to summary
public static final int TOKEN_PREFIX_SMALL_INT
TOKEN_PREFIX_TINY_ASCIIback to summary
public static final int TOKEN_PREFIX_TINY_ASCII
TOKEN_PREFIX_TINY_UNICODEback to summary
public static final int TOKEN_PREFIX_TINY_UNICODE

Constructor Detail

SmileConstantsback to summary
public SmileConstants()