Package io.objectbox.flatbuffers
Class FlexBuffers
- java.lang.Object
-
- io.objectbox.flatbuffers.FlexBuffers
-
public class FlexBuffers extends java.lang.ObjectThis 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 Classes Modifier and Type Class Description static classFlexBuffers.BlobRepresents a array of bytes element in the bufferstatic classFlexBuffers.FlexBufferExceptionstatic classFlexBuffers.KeyRepresents a key element in the buffer.static classFlexBuffers.KeyVectorRepresent a vector of keys in a mapstatic classFlexBuffers.MapMap object representing a set of key-value pairs.private static classFlexBuffers.ObjectBase class of all types below.static classFlexBuffers.ReferenceRepresents an generic element in the buffer.private static classFlexBuffers.Sizedstatic classFlexBuffers.TypedVectorObject that represents a set of elements with the same type(package private) static classFlexBuffers.Unsignedstatic classFlexBuffers.VectorObject that represents a set of elements in the buffer
-
Field Summary
Fields Modifier and Type Field Description private static ReadBufEMPTY_BBstatic intFBT_BLOBRepresent a blob typestatic intFBT_BOOLRepresent a boolean typestatic intFBT_FLOATRepresent a float typestatic intFBT_INDIRECT_FLOATRepresent a indirect float typestatic intFBT_INDIRECT_INTRepresent a indirect signed integer typestatic intFBT_INDIRECT_UINTRepresent a indirect unsigned integer typestatic intFBT_INTRepresent a signed integer typestatic intFBT_KEYRepresent a key to a map typestatic intFBT_MAPRepresent a map typestatic intFBT_NULLRepresent a null typestatic intFBT_STRINGRepresent a string typestatic intFBT_UINTRepresent a unsigned typestatic intFBT_VECTORRepresent a vector typestatic intFBT_VECTOR_BOOLRepresent a vector of booleans typestatic intFBT_VECTOR_FLOATRepresent a vector of floats typestatic intFBT_VECTOR_FLOAT2static intFBT_VECTOR_FLOAT3static intFBT_VECTOR_FLOAT4static intFBT_VECTOR_INTRepresent a vector of signed integers typestatic intFBT_VECTOR_INT2static intFBT_VECTOR_INT3static intFBT_VECTOR_INT4static intFBT_VECTOR_KEYRepresent a vector of keys typestatic intFBT_VECTOR_STRING_DEPRECATEDRepresent a vector of strings typestatic intFBT_VECTOR_UINTRepresent a vector of unsigned integers typestatic intFBT_VECTOR_UINT2static intFBT_VECTOR_UINT3static intFBT_VECTOR_UINT4
-
Constructor Summary
Constructors Constructor Description FlexBuffers()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static FlexBuffers.ReferencegetRoot(ReadBuf buffer)Reads a FlexBuffer message in ReadBuf and returnsFlexBuffers.Referenceto the root element.static FlexBuffers.ReferencegetRoot(java.nio.ByteBuffer buffer)Deprecated.private static intindirect(ReadBuf bb, int offset, int byteWidth)(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 intreadInt(ReadBuf buff, int end, int byteWidth)private static longreadLong(ReadBuf buff, int end, int byteWidth)private static longreadUInt(ReadBuf buff, int end, int byteWidth)(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 Detail
-
FBT_NULL
public static final int FBT_NULL
Represent a null type- See Also:
- Constant Field Values
-
FBT_INT
public static final int FBT_INT
Represent a signed integer type- See Also:
- Constant Field Values
-
FBT_UINT
public static final int FBT_UINT
Represent a unsigned type- See Also:
- Constant Field Values
-
FBT_FLOAT
public static final int FBT_FLOAT
Represent a float type- See Also:
- Constant Field Values
-
FBT_KEY
public static final int FBT_KEY
Represent a key to a map type- See Also:
- Constant Field Values
-
FBT_STRING
public static final int FBT_STRING
Represent a string type- See Also:
- Constant Field Values
-
FBT_INDIRECT_INT
public static final int FBT_INDIRECT_INT
Represent a indirect signed integer type- See Also:
- Constant Field Values
-
FBT_INDIRECT_UINT
public static final int FBT_INDIRECT_UINT
Represent a indirect unsigned integer type- See Also:
- Constant Field Values
-
FBT_INDIRECT_FLOAT
public static final int FBT_INDIRECT_FLOAT
Represent a indirect float type- See Also:
- Constant Field Values
-
FBT_MAP
public static final int FBT_MAP
Represent a map type- See Also:
- Constant Field Values
-
FBT_VECTOR
public static final int FBT_VECTOR
Represent a vector type- See Also:
- Constant Field Values
-
FBT_VECTOR_INT
public static final int FBT_VECTOR_INT
Represent a vector of signed integers type- See Also:
- Constant Field Values
-
FBT_VECTOR_UINT
public static final int FBT_VECTOR_UINT
Represent a vector of unsigned integers type- See Also:
- Constant Field Values
-
FBT_VECTOR_FLOAT
public static final int FBT_VECTOR_FLOAT
Represent a vector of floats type- See Also:
- Constant Field Values
-
FBT_VECTOR_KEY
public static final int FBT_VECTOR_KEY
Represent a vector of keys type- See Also:
- Constant Field Values
-
FBT_VECTOR_STRING_DEPRECATED
public static final int FBT_VECTOR_STRING_DEPRECATED
Represent a vector of strings type- See Also:
- Constant Field Values
-
FBT_VECTOR_INT2
public static final int FBT_VECTOR_INT2
- See Also:
- Constant Field Values
-
FBT_VECTOR_UINT2
public static final int FBT_VECTOR_UINT2
- See Also:
- Constant Field Values
-
FBT_VECTOR_FLOAT2
public static final int FBT_VECTOR_FLOAT2
- See Also:
- Constant Field Values
-
FBT_VECTOR_INT3
public static final int FBT_VECTOR_INT3
- See Also:
- Constant Field Values
-
FBT_VECTOR_UINT3
public static final int FBT_VECTOR_UINT3
- See Also:
- Constant Field Values
-
FBT_VECTOR_FLOAT3
public static final int FBT_VECTOR_FLOAT3
- See Also:
- Constant Field Values
-
FBT_VECTOR_INT4
public static final int FBT_VECTOR_INT4
- See Also:
- Constant Field Values
-
FBT_VECTOR_UINT4
public static final int FBT_VECTOR_UINT4
- See Also:
- Constant Field Values
-
FBT_VECTOR_FLOAT4
public static final int FBT_VECTOR_FLOAT4
- See Also:
- Constant Field Values
-
FBT_BLOB
public static final int FBT_BLOB
Represent a blob type- See Also:
- Constant Field Values
-
FBT_BOOL
public static final int FBT_BOOL
Represent a boolean type- See Also:
- Constant Field Values
-
FBT_VECTOR_BOOL
public static final int FBT_VECTOR_BOOL
Represent a vector of booleans type- See Also:
- Constant Field Values
-
EMPTY_BB
private static final ReadBuf EMPTY_BB
-
-
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 typefixedLength- 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)
-
getRoot
@Deprecated public static FlexBuffers.Reference getRoot(java.nio.ByteBuffer buffer)
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
public static FlexBuffers.Reference getRoot(ReadBuf buffer)
Reads a FlexBuffer message in ReadBuf and returnsFlexBuffers.Referenceto the root element.- Parameters:
buffer- ReadBuf containing FlexBuffer message- Returns:
FlexBuffers.Referenceto the root object
-
-