FlatBuffers
An open source project by FPL.
|
Responsible for building up and accessing a FlatBuffer formatted byte array (via ByteBuffer). More...
Responsible for building up and accessing a FlatBuffer formatted byte array (via ByteBuffer).
Public Member Functions | |
void | Add< T > (Span< T > x) |
Add a span of type T to the buffer (aligns the data and grows if necessary). More... | |
void | Add< T > (T[] x) |
Add an array of type T to the buffer (aligns the data and grows if necessary). More... | |
void | AddBool (bool x) |
Add a bool to the buffer (aligns the data and grows if necessary). More... | |
void | AddByte (byte x) |
Add a byte to the buffer (aligns the data and grows if necessary). More... | |
void | AddDouble (double x) |
Add a double to the buffer (aligns the data and grows if necessary). More... | |
void | AddFloat (float x) |
Add a float to the buffer (aligns the data and grows if necessary). More... | |
void | AddInt (int x) |
Add an int to the buffer (aligns the data and grows if necessary). More... | |
void | AddLong (long x) |
Add a long to the buffer (aligns the data and grows if necessary). More... | |
void | AddOffset (int off) |
Adds an offset, relative to where it will be written. More... | |
void | AddSbyte (sbyte x) |
Add a sbyte to the buffer (aligns the data and grows if necessary). More... | |
void | AddShort (short x) |
Add a short to the buffer (aligns the data and grows if necessary). More... | |
void | AddUint (uint x) |
Add an uint to the buffer (aligns the data and grows if necessary). More... | |
void | AddUlong (ulong x) |
Add an ulong to the buffer (aligns the data and grows if necessary). More... | |
void | AddUshort (ushort x) |
Add an ushort to the buffer (aligns the data and grows if necessary). More... | |
void | Clear () |
Reset the FlatBufferBuilder by purging all data that it holds. More... | |
StringOffset | CreateSharedString (string s) |
Store a string in the buffer, which can contain any binary data. More... | |
StringOffset | CreateString (string s) |
Encode the string s in the buffer using UTF-8. More... | |
StringOffset | CreateUTF8String (Span< byte > chars) |
Creates a string in the buffer from a Span containing a UTF8 string. More... | |
VectorOffset | CreateVectorOfTables< T > (Offset< T >[] offsets) |
Creates a vector of tables. More... | |
VectorOffset | EndVector () |
Writes data necessary to finish a vector construction. More... | |
void | Finish (int rootTable) |
Finalize a buffer, pointing to the given root_table . More... | |
void | Finish (int rootTable, string fileIdentifier) |
Finalize a buffer, pointing to the given rootTable . More... | |
void | FinishSizePrefixed (int rootTable) |
Finalize a buffer, pointing to the given root_table , with the size prefixed. More... | |
void | FinishSizePrefixed (int rootTable, string fileIdentifier) |
Finalize a buffer, pointing to the given rootTable , with the size prefixed. More... | |
FlatBufferBuilder (ByteBuffer buffer) | |
Create a FlatBufferBuilder backed by the pased in ByteBuffer More... | |
FlatBufferBuilder (int initialSize) | |
Create a FlatBufferBuilder with a given initial size. More... | |
byte[] | SizedByteArray () |
A utility function to copy and return the ByteBuffer data as a byte[] . More... | |
Protected Member Functions | |
void | Finish (int rootTable, bool sizePrefix) |
Finalize a buffer, pointing to the given root_table . More... | |
void | Finish (int rootTable, string fileIdentifier, bool sizePrefix) |
Finalize a buffer, pointing to the given rootTable . More... | |
Properties | |
ByteBuffer | DataBuffer [get] |
Get the ByteBuffer representing the FlatBuffer. More... | |
bool | ForceDefaults [get, set] |
Gets and sets a Boolean to disable the optimization when serializing default values to a Table. More... | |
|
inline |
Create a FlatBufferBuilder with a given initial size.
initialSize | The initial size to use for the internal buffer. |
|
inline |
Create a FlatBufferBuilder backed by the pased in ByteBuffer
buffer | The ByteBuffer to write to |
|
inline |
Add a span of type T to the buffer (aligns the data and grows if necessary).
T | The type of the input data |
x | The span to copy data from |
T | : | struct |
|
inline |
Add an array of type T to the buffer (aligns the data and grows if necessary).
T | The type of the input data |
x | The array to copy data from |
T | : | struct |
|
inline |
Add a bool
to the buffer (aligns the data and grows if necessary).
x | The bool to add to the buffer. |
|
inline |
Add a byte
to the buffer (aligns the data and grows if necessary).
x | The byte to add to the buffer. |
|
inline |
Add a double
to the buffer (aligns the data and grows if necessary).
x | The double to add to the buffer. |
|
inline |
Add a float
to the buffer (aligns the data and grows if necessary).
x | The float to add to the buffer. |
|
inline |
Add an int
to the buffer (aligns the data and grows if necessary).
x | The int to add to the buffer. |
|
inline |
Add a long
to the buffer (aligns the data and grows if necessary).
x | The long to add to the buffer. |
|
inline |
Adds an offset, relative to where it will be written.
off | The offset to add to the buffer. |
|
inline |
Add a sbyte
to the buffer (aligns the data and grows if necessary).
x | The sbyte to add to the buffer. |
|
inline |
Add a short
to the buffer (aligns the data and grows if necessary).
x | The short to add to the buffer. |
|
inline |
Add an uint
to the buffer (aligns the data and grows if necessary).
x | The uint to add to the buffer. |
|
inline |
Add an ulong
to the buffer (aligns the data and grows if necessary).
x | The ulong to add to the buffer. |
|
inline |
Add an ushort
to the buffer (aligns the data and grows if necessary).
x | The ushort to add to the buffer. |
|
inline |
Reset the FlatBufferBuilder by purging all data that it holds.
|
inline |
Store a string in the buffer, which can contain any binary data.
If a string with this exact contents has already been serialized before, instead simply returns the offset of the existing string.
s | The string to encode. |
|
inline |
Encode the string s
in the buffer using UTF-8.
s | The string to encode. |
|
inline |
Creates a string in the buffer from a Span containing a UTF8 string.
chars | the UTF8 string to add to the buffer |
|
inline |
Creates a vector of tables.
offsets | Offsets of the tables. |
T | : | struct |
|
inline |
Writes data necessary to finish a vector construction.
|
inline |
Finalize a buffer, pointing to the given root_table
.
rootTable | An offset to be added to the buffer. |
|
inlineprotected |
Finalize a buffer, pointing to the given root_table
.
rootTable | An offset to be added to the buffer. |
sizePrefix | Whether to prefix the size to the buffer. |
|
inline |
Finalize a buffer, pointing to the given rootTable
.
rootTable | An offset to be added to the buffer. |
fileIdentifier | A FlatBuffer file identifier to be added to the buffer before root_table . |
|
inlineprotected |
Finalize a buffer, pointing to the given rootTable
.
rootTable | An offset to be added to the buffer. |
fileIdentifier | A FlatBuffer file identifier to be added to the buffer before root_table . |
sizePrefix | Whether to prefix the size to the buffer. |
|
inline |
Finalize a buffer, pointing to the given root_table
, with the size prefixed.
rootTable | An offset to be added to the buffer. |
|
inline |
Finalize a buffer, pointing to the given rootTable
, with the size prefixed.
rootTable | An offset to be added to the buffer. |
fileIdentifier | A FlatBuffer file identifier to be added to the buffer before root_table . |
|
inline |
A utility function to copy and return the ByteBuffer data as a byte[]
.
|
get |
Get the ByteBuffer representing the FlatBuffer.
This is typically only called after you call Finish()
. The actual data starts at the ByteBuffer's current position, not necessarily at 0
.
|
getset |
Gets and sets a Boolean to disable the optimization when serializing default values to a Table.
In order to save space, fields that are set to their default value don't get serialized into the buffer.