| FlatBuffers An open source project by FPL.

- Programmer's Guide
- Platform / Language / Feature support
- Benchmarks
- FlatBuffers white paper
- FlatBuffers internals
- Grammar of the schema language
- API Reference
- Contributing

- APIs
- Class List

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Properties | List of all members
FlatBuffers.FlatBufferBuilder Class Reference
Flatbuffers_csharp_api

Responsible for building up and accessing a FlatBuffer formatted byte array (via ByteBuffer). More...

## Detailed Description

Responsible for building up and accessing a FlatBuffer formatted byte array (via ByteBuffer).

## Public Member Functions
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 | CreateString (string s)
| Encode the string `s` in the buffer using UTF-8. 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...
| 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...

## 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...

## Constructor & Destructor Documentation

FlatBuffers.FlatBufferBuilder.FlatBufferBuilder | ( | int | initialSize | ) |
| inline

Create a FlatBufferBuilder with a given initial size.

Parameters

  initialSize | The initial size to use for the internal buffer.

## Member Function Documentation

void FlatBuffers.FlatBufferBuilder.AddBool | ( | bool | x | ) |
| inline

Add a `bool` to the buffer (aligns the data and grows if necessary).

Parameters

  x | The `bool` to add to the buffer.

void FlatBuffers.FlatBufferBuilder.AddByte | ( | byte | x | ) |
| inline

Add a `byte` to the buffer (aligns the data and grows if necessary).

Parameters

  x | The `byte` to add to the buffer.

void FlatBuffers.FlatBufferBuilder.AddDouble | ( | double | x | ) |
| inline

Add a `double` to the buffer (aligns the data and grows if necessary).

Parameters

  x | The `double` to add to the buffer.

void FlatBuffers.FlatBufferBuilder.AddFloat | ( | float | x | ) |
| inline

Add a `float` to the buffer (aligns the data and grows if necessary).

Parameters

  x | The `float` to add to the buffer.

void FlatBuffers.FlatBufferBuilder.AddInt | ( | int | x | ) |
| inline

Add an `int` to the buffer (aligns the data and grows if necessary).

Parameters

  x | The `int` to add to the buffer.

void FlatBuffers.FlatBufferBuilder.AddLong | ( | long | x | ) |
| inline

Add a `long` to the buffer (aligns the data and grows if necessary).

Parameters

  x | The `long` to add to the buffer.

void FlatBuffers.FlatBufferBuilder.AddOffset | ( | int | off | ) |
| inline

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

Parameters

  off | The offset to add to the buffer.

void FlatBuffers.FlatBufferBuilder.AddSbyte | ( | sbyte | x | ) |
| inline

Add a `sbyte` to the buffer (aligns the data and grows if necessary).

Parameters

  x | The `sbyte` to add to the buffer.

void FlatBuffers.FlatBufferBuilder.AddShort | ( | short | x | ) |
| inline

Add a `short` to the buffer (aligns the data and grows if necessary).

Parameters

  x | The `short` to add to the buffer.

void FlatBuffers.FlatBufferBuilder.AddUint | ( | uint | x | ) |
| inline

Add an `uint` to the buffer (aligns the data and grows if necessary).

Parameters

  x | The `uint` to add to the buffer.

void FlatBuffers.FlatBufferBuilder.AddUlong | ( | ulong | x | ) |
| inline

Add an `ulong` to the buffer (aligns the data and grows if necessary).

Parameters

  x | The `ulong` to add to the buffer.

void FlatBuffers.FlatBufferBuilder.AddUshort | ( | ushort | x | ) |
| inline

Add an `ushort` to the buffer (aligns the data and grows if necessary).

Parameters

  x | The `ushort` to add to the buffer.

void FlatBuffers.FlatBufferBuilder.Clear | ( |  | ) |
| inline

Reset the FlatBufferBuilder by purging all data that it holds.

StringOffset FlatBuffers.FlatBufferBuilder.CreateString | ( | string | s | ) |
| inline

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

Parameters

  s | The string to encode.

Returns
  The offset in the buffer where the encoded string starts.

VectorOffset FlatBuffers.FlatBufferBuilder.CreateVectorOfTables< T > | ( | Offset< T >[] | offsets | ) |
| inline

Creates a vector of tables.

Parameters

  offsets | Offsets of the tables.

Type Constraints

  T | : | struct |

VectorOffset FlatBuffers.FlatBufferBuilder.EndVector | ( |  | ) |
| inline

Writes data necessary to finish a vector construction.

void FlatBuffers.FlatBufferBuilder.Finish | ( | int | rootTable | ) |
| inline

Finalize a buffer, pointing to the given `root_table`.

Parameters

  rootTable | An offset to be added to the buffer.

void FlatBuffers.FlatBufferBuilder.Finish | ( | int | rootTable,
|  | string | fileIdentifier
| ) |  |
| inline

Finalize a buffer, pointing to the given `rootTable`.

Parameters

  rootTable | An offset to be added to the buffer.
  fileIdentifier | A FlatBuffer file identifier to be added to the buffer before `root_table`.

byte [] FlatBuffers.FlatBufferBuilder.SizedByteArray | ( |  | ) |
| inline

A utility function to copy and return the ByteBuffer data as a `byte[]`.

Returns
  A full copy of the FlatBuffer data.

## Property Documentation

ByteBuffer FlatBuffers.FlatBufferBuilder.DataBuffer
| 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`.

Returns
  Returns the ByteBuffer for this FlatBuffer.

bool FlatBuffers.FlatBufferBuilder.ForceDefaults
| get set

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.

The documentation for this class was generated from the following file:

- FlatBufferBuilder.cs