FlatBuffers
An open source project by FPL.
Google\FlatBuffers\FlatbufferBuilder Class Reference

Public Member Functions

 __construct ($initial_size)
 Create a FlatBufferBuilder with a given initial size. More...
 
 addBool ($x)
 Add a bool to the buffer, properly aligned, and grows the buffer (if necessary). More...
 
 addByte ($x)
 Add a byte to the buffer, properly aligned, and grows the buffer (if necessary). More...
 
 addDouble ($x)
 Add a double to the buffer, properly aligned, and grows the buffer (if necessary). More...
 
 addFloat ($x)
 Add a float to the buffer, properly aligned, and grows the buffer (if necessary). More...
 
 addInt ($x)
 Add an int to the buffer, properly aligned, and grows the buffer (if necessary). More...
 
 addLong ($x)
 Add a long to the buffer, properly aligned, and grows the buffer (if necessary). More...
 
 addOffset ($off)
 Adds on offset, relative to where it will be written. More...
 
 addSbyte ($x)
 Add a signed byte to the buffer, properly aligned, and grows the buffer (if necessary). More...
 
 addShort ($x)
 Add a short to the buffer, properly aligned, and grows the buffer (if necessary). More...
 
 addUint ($x)
 Add an unsigned int to the buffer, properly aligned, and grows the buffer (if necessary). More...
 
 addUlong ($x)
 Add an unsigned long to the buffer, properly aligned, and grows the buffer (if necessary). More...
 
 addUshort ($x)
 Add an unsigned short to the buffer, properly aligned, and grows the buffer (if necessary). More...
 
 createString ($s)
 Encode the string $s in the buffer using UTF-8. More...
 
 dataBuffer ()
 Get the ByteBuffer representing the FlatBuffer. More...
 
 finish ($root_table, $identifier=null)
 Finalize a buffer, pointing to the given $root_table. More...
 
 forceDefaults ($forceDefaults)
 In order to save space, fields that are set to their default value don't get serialized into the buffer. More...
 
 sizedByteArray ()
 Utility function to copy and return the FlatBuffer data from the underlying ByteBuffer. More...
 

Public Attributes

 $bb
 Internal ByteBuffer for the FlatBuffer data.
 

Constructor & Destructor Documentation

◆ __construct()

Google\FlatBuffers\FlatbufferBuilder::__construct (   $initial_size)

Create a FlatBufferBuilder with a given initial size.

Parameters
$initial_sizeinitial byte buffer size.

Member Function Documentation

◆ addBool()

Google\FlatBuffers\FlatbufferBuilder::addBool (   $x)

Add a bool to the buffer, properly aligned, and grows the buffer (if necessary).

Parameters
$xThe bool to add to the buffer.

◆ addByte()

Google\FlatBuffers\FlatbufferBuilder::addByte (   $x)

Add a byte to the buffer, properly aligned, and grows the buffer (if necessary).

Parameters
$xThe byte to add to the buffer.

◆ addDouble()

Google\FlatBuffers\FlatbufferBuilder::addDouble (   $x)

Add a double to the buffer, properly aligned, and grows the buffer (if necessary).

Parameters
$xThe double to add to the buffer.

◆ addFloat()

Google\FlatBuffers\FlatbufferBuilder::addFloat (   $x)

Add a float to the buffer, properly aligned, and grows the buffer (if necessary).

Parameters
$xThe float to add to the buffer.

◆ addInt()

Google\FlatBuffers\FlatbufferBuilder::addInt (   $x)

Add an int to the buffer, properly aligned, and grows the buffer (if necessary).

Parameters
$xThe int to add to the buffer.

◆ addLong()

Google\FlatBuffers\FlatbufferBuilder::addLong (   $x)

Add a long to the buffer, properly aligned, and grows the buffer (if necessary).

Parameters
$xThe long to add to the buffer.

◆ addOffset()

Google\FlatBuffers\FlatbufferBuilder::addOffset (   $off)

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

Parameters
$offThe offset to add to the buffer.
Exceptions

◆ addSbyte()

Google\FlatBuffers\FlatbufferBuilder::addSbyte (   $x)

Add a signed byte to the buffer, properly aligned, and grows the buffer (if necessary).

Parameters
$xThe signed byte to add to the buffer.

◆ addShort()

Google\FlatBuffers\FlatbufferBuilder::addShort (   $x)

Add a short to the buffer, properly aligned, and grows the buffer (if necessary).

Parameters
$xThe short to add to the buffer.

◆ addUint()

Google\FlatBuffers\FlatbufferBuilder::addUint (   $x)

Add an unsigned int to the buffer, properly aligned, and grows the buffer (if necessary).

Parameters
$xThe unsigned int to add to the buffer.

◆ addUlong()

Google\FlatBuffers\FlatbufferBuilder::addUlong (   $x)

Add an unsigned long to the buffer, properly aligned, and grows the buffer (if necessary).

Parameters
$xThe unsigned long to add to the buffer.

◆ addUshort()

Google\FlatBuffers\FlatbufferBuilder::addUshort (   $x)

Add an unsigned short to the buffer, properly aligned, and grows the buffer (if necessary).

Parameters
$xThe unsigned short to add to the buffer.

◆ createString()

Google\FlatBuffers\FlatbufferBuilder::createString (   $s)

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

Parameters
string$sThe string to encode.
Returns
int The offset in the buffer where the encoded string starts.
Exceptions
InvalidArgumentExceptionThrown if the input string $s is not UTF-8.

◆ dataBuffer()

Google\FlatBuffers\FlatbufferBuilder::dataBuffer ( )

Get the ByteBuffer representing the FlatBuffer.

Returns
ByteBuffer The ByteBuffer containing the FlatBuffer data.

◆ finish()

Google\FlatBuffers\FlatbufferBuilder::finish (   $root_table,
  $identifier = null 
)

Finalize a buffer, pointing to the given $root_table.

Parameters
$root_tableAn offest to be added to the buffer.
$file_identifierA FlatBuffer file identifier to be added to the buffer before $root_table. This defaults to null.
Exceptions
InvalidArgumentExceptionThrown if an invalid $identifier is given, where its length is not equal to Constants::FILE_IDENTIFIER_LENGTH.

◆ forceDefaults()

Google\FlatBuffers\FlatbufferBuilder::forceDefaults (   $forceDefaults)

In order to save space, fields that are set to their default value don't get serialized into the buffer.

Parameters
bool$forceDefaultsWhen set to true, always serializes default values.

◆ sizedByteArray()

Google\FlatBuffers\FlatbufferBuilder::sizedByteArray ( )

Utility function to copy and return the FlatBuffer data from the underlying ByteBuffer.

Returns
string A string (representing a byte[]) that contains a copy of the FlatBuffer data.

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