FlatBufferBuilder

Responsible for building up and accessing a FlatBuffer formatted byte

Constructors

this
this(size_t initsize)

Create a FlatBufferBuilder with a given initial size.

this
this(ByteBuffer buffer)
Undocumented in source.

Members

Functions

add
void add(T x)

Adds a scalar to the buffer, properly aligned, and the buffer grown if needed.

add
void add(size_t o, T x, T d)

Add a scalar to a table at o into its vtable, with value x and default d.

addOffset
void addOffset(uint off)

Adds on offset, relative to where it will be written.

addOffset
void addOffset(int o, int x, int d)

Add a scalar to a table at o into its vtable, with value x and default d.

addStruct
void addStruct(int voffset, int x, int d)

Structs are stored inline, so nothing additional is being added. d is always 0.

createString
uint createString(string s)

Encode the string s in the buffer using UTF-8.

dataBuffer
ByteBuffer dataBuffer()

Get the ByteBuffer representing the FlatBuffer. Notes: his is typically only called after you call Finish().

endObject
uint endObject()
Undocumented in source. Be warned that the author may not have intended to support it.
endVector
uint endVector()
Undocumented in source. Be warned that the author may not have intended to support it.
finish
void finish(int rootTable)

Finalize a buffer, pointing to the given root_table.

finish
void finish(int rootTable, string fileIdentifier)

Finalize a buffer, pointing to the given rootTable.

growBuffer
void growBuffer()

Doubles the size of the ByteBuffer, and copies the old data towards the end of the new buffer (since we build the buffer backwards).

nested
void nested(int obj)
Undocumented in source. Be warned that the author may not have intended to support it.
notNested
void notNested()
Undocumented in source. Be warned that the author may not have intended to support it.
offset
uint offset()
Undocumented in source. Be warned that the author may not have intended to support it.
pad
void pad(size_t size)
Undocumented in source. Be warned that the author may not have intended to support it.
prep
void prep(size_t size, size_t additionalBytes)

Prepare to write an element of size after additional_bytes have been written, e.g. if you write a string, you need to align such the int length field is aligned to SIZEOF_INT, and the string data follows it directly. If all you need to do is align, additional_bytes will be 0.

put
void put(T x)

put a value into the buffer.

required
void required(int table, int field)

This checks a required field has been set in a given table that has just been constructed.

sizedByteArray
ubyte[] sizedByteArray()

A utility function to copy and return the ByteBuffer data as a ubyte[] Retuens: the byte used in FlatBuffer data, it is not copy.

slot
void slot(size_t voffset)

Set the current vtable at voffset to the current location in the buffer.

startObject
void startObject(int numfields)
Undocumented in source. Be warned that the author may not have intended to support it.
startVector
void startVector(int elemSize, int count, int alignment)
Undocumented in source. Be warned that the author may not have intended to support it.

Meta