Package com.couchbase.client.core.msg.kv
Enum CodecFlags
- java.lang.Object
-
- java.lang.Enum<CodecFlags>
-
- com.couchbase.client.core.msg.kv.CodecFlags
-
- All Implemented Interfaces:
Serializable
,Comparable<CodecFlags>
public enum CodecFlags extends Enum<CodecFlags>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CodecFlags.CommonFlags
The common flags enum.
-
Field Summary
Fields Modifier and Type Field Description static int
BINARY_COMMON_FLAGS
static int
BINARY_COMPAT_FLAGS
static int
BINARY_LEGACY_FLAGS
static int
BOOLEAN_COMPAT_FLAGS
static int
BOOLEAN_LEGACY_FLAGS
static int
COMMON_FORMAT_MASK
32bit flag is composed of: - 3 compression bits - 1 bit reserved for future use - 4 format flags bits.static int
DOUBLE_COMPAT_FLAGS
static int
DOUBLE_LEGACY_FLAGS
static int
JSON_COMMON_FLAGS
static int
JSON_COMPAT_FLAGS
static int
JSON_LEGACY_FLAGS
static int
LONG_COMPAT_FLAGS
static int
LONG_LEGACY_FLAGS
static int
PRIVATE_COMMON_FLAGS
static int
SERIALIZED_COMPAT_FLAGS
static int
SERIALIZED_LEGACY_FLAGS
static int
STRING_COMMON_FLAGS
static int
STRING_COMPAT_FLAGS
static int
STRING_LEGACY_FLAGS
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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 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
valueOf(String name)
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 Detail
-
COMMON_FORMAT_MASK
public static final int COMMON_FORMAT_MASK
32bit 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").
-
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:
- Constant Field Values
-
BINARY_LEGACY_FLAGS
public static final int BINARY_LEGACY_FLAGS
- See Also:
- Constant Field Values
-
STRING_LEGACY_FLAGS
public static final int STRING_LEGACY_FLAGS
- See Also:
- Constant Field Values
-
JSON_LEGACY_FLAGS
public static final int JSON_LEGACY_FLAGS
- See Also:
- Constant Field Values
-
BOOLEAN_LEGACY_FLAGS
public static final int BOOLEAN_LEGACY_FLAGS
- See Also:
- Constant Field Values
-
LONG_LEGACY_FLAGS
public static final int LONG_LEGACY_FLAGS
- See Also:
- Constant Field Values
-
DOUBLE_LEGACY_FLAGS
public static final int DOUBLE_LEGACY_FLAGS
- See Also:
- Constant Field Values
-
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 Detail
-
values
public static CodecFlags[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (CodecFlags c : CodecFlags.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static CodecFlags valueOf(String name)
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).
-
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.
-
-