Enum CodecFlags

    • 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").
        See Also:
        extractCommonFlags(int), hasCommonFlags(int), hasCompressionFlags(int), Constant Field Values
      • 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
      • 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 name
        NullPointerException - 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 check
        expectedCommonFlag - 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.