package com.fasterxml.jackson.dataformat.cbor;
public final class CBORConstants
{
public final static int MAJOR_TYPE_INT_POS = 0;
public final static int MAJOR_TYPE_INT_NEG = 1;
public final static int MAJOR_TYPE_BYTES = 2;
public final static int MAJOR_TYPE_TEXT = 3;
public final static int MAJOR_TYPE_ARRAY = 4;
public final static int MAJOR_TYPE_OBJECT = 5;
public final static int MAJOR_TYPE_TAG = 6;
public final static int MAJOR_TYPE_MISC = 7;
public final static int PREFIX_TYPE_INT_POS = (MAJOR_TYPE_INT_POS << 5);
public final static int PREFIX_TYPE_INT_NEG = (MAJOR_TYPE_INT_NEG << 5);
public final static int PREFIX_TYPE_BYTES = (MAJOR_TYPE_BYTES << 5);
public final static int PREFIX_TYPE_TEXT = (MAJOR_TYPE_TEXT << 5);
public final static int PREFIX_TYPE_ARRAY = (MAJOR_TYPE_ARRAY << 5);
public final static int PREFIX_TYPE_OBJECT = (MAJOR_TYPE_OBJECT << 5);
public final static int PREFIX_TYPE_TAG = (MAJOR_TYPE_TAG << 5);
public final static int PREFIX_TYPE_MISC = (MAJOR_TYPE_MISC << 5);
public final static int SUFFIX_INDEFINITE = 0x1F;
public final static int SUFFIX_UINT8_ELEMENTS = 0x18;
public final static int SUFFIX_UINT16_ELEMENTS = 0x19;
public final static int SUFFIX_UINT32_ELEMENTS = 0x1A;
public final static int SUFFIX_UINT64_ELEMENTS = 0x1B;
public final static int MASK_MAJOR_TYPE = 0xE0;
public final static int TAG_ID_SELF_DESCRIBE = 55799;
public final static byte BYTE_ARRAY_INDEFINITE = (byte) (PREFIX_TYPE_ARRAY + SUFFIX_INDEFINITE);
public final static byte BYTE_ARRAY_2_ELEMENTS = (byte) (PREFIX_TYPE_ARRAY + 2);
public final static byte BYTE_OBJECT_INDEFINITE = (byte) (PREFIX_TYPE_OBJECT + SUFFIX_INDEFINITE);
public final static byte BYTE_FALSE = (byte) (PREFIX_TYPE_MISC + 20);
public final static byte BYTE_TRUE = (byte) (PREFIX_TYPE_MISC + 21);
public final static byte BYTE_NULL = (byte) (PREFIX_TYPE_MISC + 22);
public final static byte BYTE_EMPTY_STRING = (byte) (PREFIX_TYPE_TEXT);
public final static byte BYTE_STRING_INDEFINITE = (byte) (PREFIX_TYPE_TEXT + SUFFIX_INDEFINITE);
public final static byte BYTE_STRING_1BYTE_LEN = (byte) (PREFIX_TYPE_TEXT + 24);
public final static byte BYTE_STRING_2BYTE_LEN = (byte) (PREFIX_TYPE_TEXT + 25);
public final static byte BYTE_FLOAT16 = (byte) (PREFIX_TYPE_MISC + 25);
public final static byte BYTE_FLOAT32 = (byte) (PREFIX_TYPE_MISC + 26);
public final static byte BYTE_FLOAT64 = (byte) (PREFIX_TYPE_MISC + 27);
public final static int TAG_BIGNUM_POS = 2;
public final static int TAG_BIGNUM_NEG = 3;
public final static int TAG_DECIMAL_FRACTION = 4;
public final static int TAG_BIGFLOAT = 5;
public final static byte BYTE_TAG_BIGNUM_POS = (byte) (PREFIX_TYPE_TAG + TAG_BIGNUM_POS);
public final static byte BYTE_TAG_BIGNUM_NEG = (byte) (PREFIX_TYPE_TAG + TAG_BIGNUM_NEG);
public final static byte BYTE_TAG_DECIMAL_FRACTION = (byte) (PREFIX_TYPE_TAG + TAG_DECIMAL_FRACTION);
public final static byte BYTE_TAG_BIGFLOAT = (byte) (PREFIX_TYPE_TAG + TAG_BIGFLOAT);
public final static byte BYTE_BREAK = (byte) 0xFF;
public final static int INT_BREAK = 0xFF;
public final static int[] sUtf8UnitLengths;
static {
int[] table = new int[256];
for (int c = 128; c < 256; ++c) {
int code;
if ((c & 0xE0) == 0xC0) {
code = 1;
} else if ((c & 0xF0) == 0xE0) {
code = 2;
} else if ((c & 0xF8) == 0xF0) {
code = 3;
} else {
code = -1;
}
table[c] = code;
}
sUtf8UnitLengths = table;
}
public static boolean hasMajorType(int expType, byte encoded) {
int actual = (encoded & MASK_MAJOR_TYPE) >> 5;
return (actual == expType);
}
}