Class FlexBuffers


  • public class FlexBuffers
    extends java.lang.Object
    This class can be used to parse FlexBuffer messages.

    For generating FlexBuffer messages, use FlexBuffersBuilder.

    Example of usage:

     ReadBuf bb = ... // load message from file or network
     FlexBuffers.Reference r = FlexBuffers.getRoot(bb); // Reads the root element
     FlexBuffers.Map map = r.asMap(); // We assumed root object is a map
     System.out.println(map.get("name").asString()); // prints element with key "name"
     
    • Constructor Detail

      • FlexBuffers

        public FlexBuffers()
    • Method Detail

      • isTypedVector

        static boolean isTypedVector​(int type)
        Checks where a type is a typed vector
        Parameters:
        type - type to be checked
        Returns:
        true if typed vector
      • isTypeInline

        static boolean isTypeInline​(int type)
        Check whether you can access type directly (no indirection) or not.
        Parameters:
        type - type to be checked
        Returns:
        true if inline type
      • toTypedVectorElementType

        static int toTypedVectorElementType​(int original_type)
      • toTypedVector

        static int toTypedVector​(int type,
                                 int fixedLength)
        Return a vector type our of a original element type
        Parameters:
        type - element type
        fixedLength - size of element
        Returns:
        typed vector type
      • isTypedVectorElementType

        static boolean isTypedVectorElementType​(int type)
      • indirect

        private static int indirect​(ReadBuf bb,
                                    int offset,
                                    int byteWidth)
      • readUInt

        private static long readUInt​(ReadBuf buff,
                                     int end,
                                     int byteWidth)
      • readInt

        private static int readInt​(ReadBuf buff,
                                   int end,
                                   int byteWidth)
      • readLong

        private static long readLong​(ReadBuf buff,
                                     int end,
                                     int byteWidth)
      • readDouble

        private static double readDouble​(ReadBuf buff,
                                         int end,
                                         int byteWidth)