Package io.objectbox.flatbuffers
Class FlexBuffers
java.lang.Object
io.objectbox.flatbuffers.FlexBuffers
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"
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents a array of bytes element in the bufferstatic classstatic classRepresents a key element in the buffer.static classRepresent a vector of keys in a mapstatic classMap object representing a set of key-value pairs.private static classBase class of all types below.static classRepresents an generic element in the buffer.private static classstatic classObject that represents a set of elements with the same type(package private) static classstatic classObject that represents a set of elements in the buffer -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final ReadBufstatic final intRepresent a blob typestatic final intRepresent a boolean typestatic final intRepresent a float typestatic final intRepresent a indirect float typestatic final intRepresent a indirect signed integer typestatic final intRepresent a indirect unsigned integer typestatic final intRepresent a signed integer typestatic final intRepresent a key to a map typestatic final intRepresent a map typestatic final intRepresent a null typestatic final intRepresent a string typestatic final intRepresent a unsigned typestatic final intRepresent a vector typestatic final intRepresent a vector of booleans typestatic final intRepresent a vector of floats typestatic final intstatic final intstatic final intstatic final intRepresent a vector of signed integers typestatic final intstatic final intstatic final intstatic final intRepresent a vector of keys typestatic final intRepresent a vector of strings typestatic final intRepresent a vector of unsigned integers typestatic final intstatic final intstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic FlexBuffers.ReferenceReads a FlexBuffer message in ReadBuf and returnsFlexBuffers.Referenceto the root element.static FlexBuffers.ReferencegetRoot(ByteBuffer buffer) Deprecated.private static int(package private) static booleanisTypedVector(int type) Checks where a type is a typed vector(package private) static booleanisTypedVectorElementType(int type) (package private) static booleanisTypeInline(int type) Check whether you can access type directly (no indirection) or not.private static doublereadDouble(ReadBuf buff, int end, int byteWidth) private static intprivate static longprivate static long(package private) static inttoTypedVector(int type, int fixedLength) Return a vector type our of a original element type(package private) static inttoTypedVectorElementType(int original_type)
-
Field Details
-
FBT_NULL
public static final int FBT_NULLRepresent a null type- See Also:
-
FBT_INT
public static final int FBT_INTRepresent a signed integer type- See Also:
-
FBT_UINT
public static final int FBT_UINTRepresent a unsigned type- See Also:
-
FBT_FLOAT
public static final int FBT_FLOATRepresent a float type- See Also:
-
FBT_KEY
public static final int FBT_KEYRepresent a key to a map type- See Also:
-
FBT_STRING
public static final int FBT_STRINGRepresent a string type- See Also:
-
FBT_INDIRECT_INT
public static final int FBT_INDIRECT_INTRepresent a indirect signed integer type- See Also:
-
FBT_INDIRECT_UINT
public static final int FBT_INDIRECT_UINTRepresent a indirect unsigned integer type- See Also:
-
FBT_INDIRECT_FLOAT
public static final int FBT_INDIRECT_FLOATRepresent a indirect float type- See Also:
-
FBT_MAP
public static final int FBT_MAPRepresent a map type- See Also:
-
FBT_VECTOR
public static final int FBT_VECTORRepresent a vector type- See Also:
-
FBT_VECTOR_INT
public static final int FBT_VECTOR_INTRepresent a vector of signed integers type- See Also:
-
FBT_VECTOR_UINT
public static final int FBT_VECTOR_UINTRepresent a vector of unsigned integers type- See Also:
-
FBT_VECTOR_FLOAT
public static final int FBT_VECTOR_FLOATRepresent a vector of floats type- See Also:
-
FBT_VECTOR_KEY
public static final int FBT_VECTOR_KEYRepresent a vector of keys type- See Also:
-
FBT_VECTOR_STRING_DEPRECATED
public static final int FBT_VECTOR_STRING_DEPRECATEDRepresent a vector of strings type- See Also:
-
FBT_VECTOR_INT2
public static final int FBT_VECTOR_INT2- See Also:
-
FBT_VECTOR_UINT2
public static final int FBT_VECTOR_UINT2- See Also:
-
FBT_VECTOR_FLOAT2
public static final int FBT_VECTOR_FLOAT2- See Also:
-
FBT_VECTOR_INT3
public static final int FBT_VECTOR_INT3- See Also:
-
FBT_VECTOR_UINT3
public static final int FBT_VECTOR_UINT3- See Also:
-
FBT_VECTOR_FLOAT3
public static final int FBT_VECTOR_FLOAT3- See Also:
-
FBT_VECTOR_INT4
public static final int FBT_VECTOR_INT4- See Also:
-
FBT_VECTOR_UINT4
public static final int FBT_VECTOR_UINT4- See Also:
-
FBT_VECTOR_FLOAT4
public static final int FBT_VECTOR_FLOAT4- See Also:
-
FBT_BLOB
public static final int FBT_BLOBRepresent a blob type- See Also:
-
FBT_BOOL
public static final int FBT_BOOLRepresent a boolean type- See Also:
-
FBT_VECTOR_BOOL
public static final int FBT_VECTOR_BOOLRepresent a vector of booleans type- See Also:
-
EMPTY_BB
-
-
Constructor Details
-
FlexBuffers
public FlexBuffers()
-
-
Method Details
-
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 typefixedLength- size of element- Returns:
- typed vector type
-
isTypedVectorElementType
static boolean isTypedVectorElementType(int type) -
indirect
-
readUInt
-
readInt
-
readLong
-
readDouble
-
getRoot
Deprecated.Reads a FlexBuffer message in ReadBuf and returnsFlexBuffers.Referenceto the root element.- Parameters:
buffer- ReadBuf containing FlexBuffer message- Returns:
FlexBuffers.Referenceto the root object
-
getRoot
Reads a FlexBuffer message in ReadBuf and returnsFlexBuffers.Referenceto the root element.- Parameters:
buffer- ReadBuf containing FlexBuffer message- Returns:
FlexBuffers.Referenceto the root object
-