Package com.couchbase.client.core.msg.kv
Enum CodecFlags
- All Implemented Interfaces:
Serializable
,Comparable<CodecFlags>
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
static final int
32bit flag is composed of: - 3 compression bits - 1 bit reserved for future use - 4 format flags bits.static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
createCommonFlags
(int flags) Takes a integer representation of flags and moves them to the common flags MSBs.static int
extractCommonFlags
(int flags) Returns only the common flags from the full flags.static int
extractCommonFormatFlags
(int userFlags) Returns just the 4 bit format field from the common flags.static boolean
hasCommonFlags
(int flags) Checks whether the upper 8 bits are set, indicating common flags presence.static boolean
hasCommonFormat
(int flags, int expectedCommonFlag) Checks that flags has common flags bits set and that they correspond to expected common flags format.static boolean
hasCompressionFlags
(int flags) Checks whether the upper 3 bits are set, indicating compression presence.static CodecFlags
Returns the enum constant of this type with the specified name.static CodecFlags[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Field Details
-
COMMON_FORMAT_MASK
public static final int COMMON_FORMAT_MASK32bit flag is composed of: - 3 compression bits - 1 bit reserved for future use - 4 format flags bits. those 8 upper bits make up the common flags - 8 bits reserved for future use - 16 bits for legacy flags This mask allows to compare a 32 bits flags with the 4 common flag format bits ("00001111 00000000 00000000 00000000").- See Also:
-
PRIVATE_COMMON_FLAGS
public static final int PRIVATE_COMMON_FLAGS -
JSON_COMMON_FLAGS
public static final int JSON_COMMON_FLAGS -
BINARY_COMMON_FLAGS
public static final int BINARY_COMMON_FLAGS -
STRING_COMMON_FLAGS
public static final int STRING_COMMON_FLAGS -
SERIALIZED_LEGACY_FLAGS
public static final int SERIALIZED_LEGACY_FLAGS- See Also:
-
BINARY_LEGACY_FLAGS
public static final int BINARY_LEGACY_FLAGS- See Also:
-
STRING_LEGACY_FLAGS
public static final int STRING_LEGACY_FLAGS- See Also:
-
JSON_LEGACY_FLAGS
public static final int JSON_LEGACY_FLAGS- See Also:
-
BOOLEAN_LEGACY_FLAGS
public static final int BOOLEAN_LEGACY_FLAGS- See Also:
-
LONG_LEGACY_FLAGS
public static final int LONG_LEGACY_FLAGS- See Also:
-
DOUBLE_LEGACY_FLAGS
public static final int DOUBLE_LEGACY_FLAGS- See Also:
-
SERIALIZED_COMPAT_FLAGS
public static final int SERIALIZED_COMPAT_FLAGS -
JSON_COMPAT_FLAGS
public static final int JSON_COMPAT_FLAGS -
BINARY_COMPAT_FLAGS
public static final int BINARY_COMPAT_FLAGS -
BOOLEAN_COMPAT_FLAGS
public static final int BOOLEAN_COMPAT_FLAGS -
LONG_COMPAT_FLAGS
public static final int LONG_COMPAT_FLAGS -
DOUBLE_COMPAT_FLAGS
public static final int DOUBLE_COMPAT_FLAGS -
STRING_COMPAT_FLAGS
public static final int STRING_COMPAT_FLAGS
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
createCommonFlags
public static int createCommonFlags(int flags) Takes a integer representation of flags and moves them to the common flags MSBs.- Parameters:
flags
- the flags to shift.- Returns:
- an integer having the common flags set.
-
hasCommonFlags
public static boolean hasCommonFlags(int flags) Checks whether the upper 8 bits are set, indicating common flags presence. It does this by shifting bits to the right until only the most significant bits are remaining and then checks if one of them is set.- Parameters:
flags
- the flags to check.- Returns:
- true if set, false otherwise.
-
hasCommonFormat
public static boolean hasCommonFormat(int flags, int expectedCommonFlag) Checks that flags has common flags bits set and that they correspond to expected common flags format.- Parameters:
flags
- the 32 bits flags to checkexpectedCommonFlag
- the expected common flags format bits- Returns:
- true if common flags bits are set and correspond to expectedCommonFlag format
-
extractCommonFlags
public static int extractCommonFlags(int flags) Returns only the common flags from the full flags.- Parameters:
flags
- the flags to check.- Returns:
- only the common flags simple representation (8 bits).
-
extractCommonFormatFlags
public static int extractCommonFormatFlags(int userFlags) Returns just the 4 bit format field from the common flags.- Parameters:
userFlags
- the full user flags flags to check.- Returns:
- only the format portion of the common flags simple representation (4 bits).
-
hasCompressionFlags
public static boolean hasCompressionFlags(int flags) Checks whether the upper 3 bits are set, indicating compression presence. It does this by shifting bits to the right until only the most significant bits are remaining and then checks if one of them is set.- Parameters:
flags
- the flags to check.- Returns:
- true if compression set, false otherwise.
-