FlexBuffersBuilder

class FlexBuffersBuilder(val buffer: ReadWriteBuffer, shareFlag: Int = SHARE_KEYS)

Constructors

Link copied to clipboard
constructor(initialCapacity: Int = 1024, shareFlag: Int = SHARE_KEYS)
constructor(buffer: ReadWriteBuffer, shareFlag: Int = SHARE_KEYS)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Functions

Link copied to clipboard
fun clear()

Reset the FlexBuffersBuilder by purging all data that it holds. Buffer might keep its capacity after a reset.

Link copied to clipboard
fun endMap(start: Int, key: String? = null): Int

Finishes a map, but writing the information in the buffer

Link copied to clipboard
fun endTypedVector(position: Int): Int

Finishes a typed vector element. The initial position of the vector must be passed

fun endTypedVector(position: Int, key: String? = null): Int
Link copied to clipboard
fun endVector(position: Int): Int
fun endVector(key: String? = null, position: Int): Int

Finishes a vector element. The initial position of the vector must be passed

Link copied to clipboard

Finish writing the message into the buffer. After that no other element must be inserted into the buffer. Also, you must call this function before start using the FlexBuffer message

Link copied to clipboard
fun put(value: Boolean)

Insert a single Boolean into the buffer

fun put(value: Byte)

Insert a single Byte into the buffer

fun put(value: ByteArray): Int

Adds a ByteArray into the message as a Blob.

fun put(value: Double)

Insert a single Double into the buffer.

fun put(value: DoubleArray): Int

Adds a DoubleArray into the message as a typed vector of fixed size.

fun put(value: Float)

Insert a single Float into the buffer.

fun put(value: FloatArray): Int

Adds a FloatArray into the message as a typed vector of fixed size.

fun put(value: Int)

Insert a single Int into the buffer.

fun put(value: IntArray): Int

Adds a IntArray into the message as a typed vector of fixed size.

fun put(value: Long)

Insert a single Long into the buffer.

fun put(value: LongArray): Int

Adds a LongArray into the message as a typed vector of fixed size.

fun put(value: Short)

Insert a single Short into the buffer.

fun put(value: ShortArray): Int

Adds a ShortArray into the message as a typed vector of fixed size.

fun put(value: String): Int

Insert a single String into the buffer.

fun put(value: UByte)

Insert a single UByte into the buffer

fun put(value: UByteArray): Int

Adds a UByteArray into the message as a typed vector of fixed size.

fun put(value: UInt)

Insert a single UInt into the buffer.

fun put(value: UIntArray): Int

Adds a UIntArray into the message as a typed vector of fixed size.

fun put(value: ULong)

Insert a single ULong into the buffer.

fun put(value: ULongArray): Int

Adds a ULongArray into the message as a typed vector of fixed size.

fun put(value: UShort)

Insert a single UShort into the buffer.

fun put(value: UShortArray): Int

Adds a UShortArray into the message as a typed vector of fixed size.

Link copied to clipboard
inline fun putMap(key: String? = null, crossinline block: FlexBuffersBuilder.() -> Unit): Int

Creates a new map will all elements inserted in block.

Link copied to clipboard
fun putNull(key: String? = null)

Insert a null reference into the buffer. A key must be present if element is inserted into a map.

Link copied to clipboard
inline fun putTypedVector(crossinline block: FlexBuffersBuilder.() -> Unit): Int

Creates a new typed vector will all elements inserted in block.

Link copied to clipboard
inline fun putVector(crossinline block: FlexBuffersBuilder.() -> Unit): Int

Creates a new vector will all elements inserted in block.

Link copied to clipboard
operator fun set(key: String? = null, value: Boolean)

Insert a single Boolean into the buffer. A key must be present if element is inserted into a map.

operator fun set(key: String? = null, value: Byte)

Insert a single Byte into the buffer. A key must be present if element is inserted into a map.

operator fun set(key: String? = null, value: ByteArray): Int

Adds a ByteArray into the message as a Blob. A key must be present if element is inserted into a map.

operator fun set(key: String? = null, value: Double)

Insert a single Double into the buffer. A key must be present if element is inserted into a map.

operator fun set(key: String? = null, value: DoubleArray): Int

Adds a DoubleArray into the message as a typed vector of fixed size. A key must be present if element is inserted into a map.

operator fun set(key: String? = null, value: Float)

Insert a single Float into the buffer. A key must be present if element is inserted into a map.

operator fun set(key: String? = null, value: FloatArray): Int

Adds a FloatArray into the message as a typed vector of fixed size. A key must be present if element is inserted into a map.

inline operator fun set(key: String? = null, value: Int)

Insert a single Int into the buffer. A key must be present if element is inserted into a map.

operator fun set(key: String? = null, value: IntArray): Int

Adds a IntArray into the message as a typed vector of fixed size. A key must be present if element is inserted into a map.

operator fun set(key: String? = null, value: Long)

Insert a single Long into the buffer. A key must be present if element is inserted into a map.

operator fun set(key: String? = null, value: LongArray): Int

Adds a LongArray into the message as a typed vector of fixed size. A key must be present if element is inserted into a map.

inline operator fun set(key: String? = null, value: Short)

Insert a single Short into the buffer. A key must be present if element is inserted into a map.

operator fun set(key: String? = null, value: ShortArray): Int

Adds a ShortArray into the message as a typed vector of fixed size. A key must be present if element is inserted into a map.

operator fun set(key: String? = null, value: String): Int

Insert a single String into the buffer. A key must be present if element is inserted into a map.

inline operator fun set(key: String? = null, value: UByte)

Insert a single UByte into the buffer. A key must be present if element is inserted into a map.

operator fun set(key: String? = null, value: UByteArray): Int

Adds a UByteArray into the message as a typed vector of fixed size. A key must be present if element is inserted into a map.

fun set(key: String? = null, value: UIntArray): Int

Adds a UIntArray into the message as a typed vector of fixed size. A key must be present if element is inserted into a map.

operator fun set(key: String? = null, value: ULong)

Insert a single ULong into the buffer. A key must be present if element is inserted into a map.

operator fun set(key: String? = null, value: ULongArray): Int

Adds a ULongArray into the message as a typed vector of fixed size. A key must be present if element is inserted into a map.

operator fun set(key: String? = null, value: UShortArray): Int

Adds a UShortArray into the message as a typed vector of fixed size. A key must be present if element is inserted into a map.

Link copied to clipboard
fun startMap(): Int

Helper function to return position for starting a new vector.

Link copied to clipboard

Helper function to return position for starting a new vector.