Package pro.streem.flatbuffers
Class Table
- java.lang.Object
-
- pro.streem.flatbuffers.Table
-
- Direct Known Subclasses:
AnimationDef,AnimListFb,AnimSource,AnimSourceEmbedded,AnimSourceFileName,AnimTableFb,BlendShape,BlendShape,BoolInit,BoolVec2Init,BoolVec3Init,BoolVec4Init,CompactSplineAnimFloatFb,CompactSplineFb,CompactSplineFloatFb,CompiledMaterialDeclDef,CompiledMaterialDef,ConstantOpFb,CubemapSamplerInit,DataBool,DataBool,DataBytes,DataBytes,DataFloat,DataFloat,DataHashValue,DataHashValue,DataInt,DataInt,DataQuat,DataQuat,DataString,DataString,DataVec2,DataVec2,DataVec3,DataVec3,DataVec4,DataVec4,DoubleInit,DoubleVec2Init,DoubleVec3Init,DoubleVec4Init,ExternalSamplerInit,InputDef,IntInit,IntVec2Init,IntVec3Init,IntVec4Init,KeyVariantPairDef,KeyVariantPairDef,LightingCubeDef,LightingCubeFaceDef,LightingDef,MaterialDef,MaterialDef,MaterialDef,MaterialTextureDef,MaterialTextureDef,MatrixAnimFb,MatrixOpFb,ModelDef,ModelDef,ModelInstanceDef,ModelInstanceDef,ModelPipelineCollidableDef,ModelPipelineCollidableDef,ModelPipelineDef,ModelPipelineDef,ModelPipelineImportDef,ModelPipelineImportDef,ModelPipelineMaterialDef,ModelPipelineMaterialDef,ModelPipelineRenderableDef,ModelPipelineRenderableDef,ModelPipelineSkeletonDef,ModelPipelineSkeletonDef,ModularParameters,NullInit,OvershootParameters,ParameterDef,ParameterInitDef,RigAnimFb,RuntimeAssetDef,SamplerDef,SamplerInit,SamplerParamsDef,ScalarInit,SceneformBundleDef,Settled1fParameters,SkeletonDef,SkeletonDef,SplineParameters,SubmeshAabb,SubmeshAabb,SuggestedCollisionShapeDef,TextureDef,TextureDef,TransformDef,TwitchParameters,VariantArrayDef,VariantArrayDef,VariantArrayDefImpl,VariantArrayDefImpl,VariantMapDef,VariantMapDef,Vec2Init,Vec3Init,Vec4Init,VersionDef
public class Table extends java.lang.ObjectAll tables in the generated code derive from this class, and add their own accessors.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.nio.ByteBufferbbThe underlying ByteBuffer to hold the data of the Table.protected intbb_posUsed to hold the position of the `bb` buffer.static java.lang.ThreadLocal<java.nio.charset.Charset>UTF8_CHARSETprotected intvtable_sizeUsed to hold the vtable size.protected intvtable_startUsed to hold the vtable position.
-
Constructor Summary
Constructors Constructor Description Table()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static boolean__has_identifier(java.nio.ByteBuffer bb, java.lang.String ident)Check if aByteBuffercontains a file identifier.protected int__indirect(int offset)Retrieve a relative offset.protected static int__indirect(int offset, java.nio.ByteBuffer bb)protected int__offset(int vtable_offset)Look up a field in the vtable.protected static int__offset(int vtable_offset, int offset, java.nio.ByteBuffer bb)void__reset()Resets the internal state with a nullByteBufferand a zero position.protected java.lang.String__string(int offset)Create a Java `String` from UTF-8 data stored inside the FlatBuffer.protected Table__union(Table t, int offset)Initialize any Table-derived type to point to the union at the given `offset`.protected int__vector(int offset)Get the start data of a vector.protected java.nio.ByteBuffer__vector_as_bytebuffer(int vector_offset, int elem_size)Get a whole vector as a ByteBuffer.protected java.nio.ByteBuffer__vector_in_bytebuffer(java.nio.ByteBuffer bb, int vector_offset, int elem_size)Initialize vector as a ByteBuffer.protected int__vector_len(int offset)Get the length of a vector.protected static intcompareStrings(int offset_1, byte[] key, java.nio.ByteBuffer bb)Compare string from the buffer with the 'String' object.protected static intcompareStrings(int offset_1, int offset_2, java.nio.ByteBuffer bb)Compare two strings in the buffer.java.nio.ByteBuffergetByteBuffer()Get the underlying ByteBuffer.protected intkeysCompare(java.lang.Integer o1, java.lang.Integer o2, java.nio.ByteBuffer bb)Compare two tables by the key.protected voidsortTables(int[] offsets, java.nio.ByteBuffer bb)Sort tables by the key.
-
-
-
Field Detail
-
UTF8_CHARSET
public static final java.lang.ThreadLocal<java.nio.charset.Charset> UTF8_CHARSET
-
bb_pos
protected int bb_pos
Used to hold the position of the `bb` buffer.
-
bb
protected java.nio.ByteBuffer bb
The underlying ByteBuffer to hold the data of the Table.
-
vtable_start
protected int vtable_start
Used to hold the vtable position.
-
vtable_size
protected int vtable_size
Used to hold the vtable size.
-
-
Method Detail
-
getByteBuffer
public java.nio.ByteBuffer getByteBuffer()
Get the underlying ByteBuffer.- Returns:
- Returns the Table's ByteBuffer.
-
__offset
protected int __offset(int vtable_offset)
Look up a field in the vtable.- Parameters:
vtable_offset- An `int` offset to the vtable in the Table's ByteBuffer.- Returns:
- Returns an offset into the object, or `0` if the field is not present.
-
__offset
protected static int __offset(int vtable_offset, int offset, java.nio.ByteBuffer bb)
-
__indirect
protected int __indirect(int offset)
Retrieve a relative offset.- Parameters:
offset- An `int` index into the Table's ByteBuffer containing the relative offset.- Returns:
- Returns the relative offset stored at `offset`.
-
__indirect
protected static int __indirect(int offset, java.nio.ByteBuffer bb)
-
__string
protected java.lang.String __string(int offset)
Create a Java `String` from UTF-8 data stored inside the FlatBuffer. This allocates a new string and converts to wide chars upon each access, which is not very efficient. Instead, each FlatBuffer string also comes with an accessor based on __vector_as_bytebuffer below, which is much more efficient, assuming your Java program can handle UTF-8 data directly.- Parameters:
offset- An `int` index into the Table's ByteBuffer.- Returns:
- Returns a `String` from the data stored inside the FlatBuffer at `offset`.
-
__vector_len
protected int __vector_len(int offset)
Get the length of a vector.- Parameters:
offset- An `int` index into the Table's ByteBuffer.- Returns:
- Returns the length of the vector whose offset is stored at `offset`.
-
__vector
protected int __vector(int offset)
Get the start data of a vector.- Parameters:
offset- An `int` index into the Table's ByteBuffer.- Returns:
- Returns the start of the vector data whose offset is stored at `offset`.
-
__vector_as_bytebuffer
protected java.nio.ByteBuffer __vector_as_bytebuffer(int vector_offset, int elem_size)Get a whole vector as a ByteBuffer. This is efficient, since it only allocates a newByteBufferobject, but does not actually copy the data, it still refers to the same bytes as the original ByteBuffer. Also useful with nested FlatBuffers, etc.- Parameters:
vector_offset- The position of the vector in the byte bufferelem_size- The size of each element in the array- Returns:
- The
ByteBufferfor the array
-
__vector_in_bytebuffer
protected java.nio.ByteBuffer __vector_in_bytebuffer(java.nio.ByteBuffer bb, int vector_offset, int elem_size)Initialize vector as a ByteBuffer. This is more efficient than using duplicate, since it doesn't copy the data nor allocattes a newByteBuffer, creating no garbage to be collected.- Parameters:
bb- TheByteBufferfor the arrayvector_offset- The position of the vector in the byte bufferelem_size- The size of each element in the array- Returns:
- The
ByteBufferfor the array
-
__union
protected Table __union(Table t, int offset)
Initialize any Table-derived type to point to the union at the given `offset`.- Parameters:
t- A `Table`-derived type that should point to the union at `offset`.offset- An `int` index into the Table's ByteBuffer.- Returns:
- Returns the Table that points to the union at `offset`.
-
__has_identifier
protected static boolean __has_identifier(java.nio.ByteBuffer bb, java.lang.String ident)Check if aByteBuffercontains a file identifier.- Parameters:
bb- AByteBufferto check if it contains the identifier `ident`.ident- A `String` identifier of the FlatBuffer file.- Returns:
- True if the buffer contains the file identifier
-
sortTables
protected void sortTables(int[] offsets, java.nio.ByteBuffer bb)Sort tables by the key.- Parameters:
offsets- An 'int' indexes of the tables into the bb.bb- AByteBufferto get the tables.
-
keysCompare
protected int keysCompare(java.lang.Integer o1, java.lang.Integer o2, java.nio.ByteBuffer bb)Compare two tables by the key.- Parameters:
o1- An 'Integer' index of the first key into the bb.o2- An 'Integer' index of the second key into the bb.bb- AByteBufferto get the keys.
-
compareStrings
protected static int compareStrings(int offset_1, int offset_2, java.nio.ByteBuffer bb)Compare two strings in the buffer.- Parameters:
offset_1- An 'int' index of the first string into the bb.offset_2- An 'int' index of the second string into the bb.bb- AByteBufferto get the strings.
-
compareStrings
protected static int compareStrings(int offset_1, byte[] key, java.nio.ByteBuffer bb)Compare string from the buffer with the 'String' object.- Parameters:
offset_1- An 'int' index of the first string into the bb.key- Second string as a byte array.bb- AByteBufferto get the first string.
-
__reset
public void __reset()
Resets the internal state with a nullByteBufferand a zero position. This method exists primarily to allow recycling Table instances without risking memory leaks due toByteBufferreferences. The instance will be unusable until it is assigned again to aByteBuffer.
-
-