Reference

class Reference

Represents an generic element in the buffer. It can be specialized into scalar types, using for example, Reference.toInt, or casted into Flexbuffer object types, like Reference.toMap or Reference.toBlob.

Properties

Link copied to clipboard

Checks whether the element type is a blob

Link copied to clipboard

Checks whether the element is boolean type

Link copied to clipboard

Checks whether the element type is float

Link copied to clipboard

Checks whether the element type is signed integer

Link copied to clipboard

Checks whether the element type is signed or unsigned integers

Link copied to clipboard

Checks whether the element type is key

Link copied to clipboard

Checks whether the element type is a map

Link copied to clipboard

Checks whether the element is null type

Link copied to clipboard

Checks whether the element type is numeric (signed/unsigned integers and floats)

Link copied to clipboard

Checks whether the element type is string

Link copied to clipboard

Checks whether the element type is typed vector

Link copied to clipboard

Checks whether the element type is signed integer

Link copied to clipboard

Checks whether the element type is vector or a map. TypedVector are considered different types and will return false.

Link copied to clipboard

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
operator fun get(index: Int): Reference

Assumes Reference as a Vector and returns a Reference at index index.

operator fun get(key: String): Reference

Assumes Reference as a Map and returns a Reference for the value at key key.

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
fun toBlob(): Blob

Returns element as a Blob

Link copied to clipboard

Returns element as a Boolean. If element type is not boolean, it will be casted to integer and compared against 0

Link copied to clipboard
fun toByte(): Byte

Returns element as Byte. For vector types, it will return size of the vector. For String type, it will be parsed as integer. Unsigned elements will become signed (with possible overflow). Float elements will be casted to Byte.

Link copied to clipboard

Returns element as a ByteArray, converting scalar types when possible.

Link copied to clipboard

Returns element as Double. For vector types, it will return size of the vector For String type, it will type to be parsed as Double

Link copied to clipboard

Returns element as a DoubleArray, converting scalar types when possible.

Link copied to clipboard
fun toFloat(): Float

Returns element as Float. For vector types, it will return size of the vector For String type, it will type to be parsed as Float Float elements will be casted to integer

Link copied to clipboard

Returns element as a FloatArray, converting scalar types when possible.

Link copied to clipboard
fun toInt(): Int

Returns element as Int. For vector types, it will return size of the vector. For String type, it will type to be parsed as integer. Unsigned elements will become signed (with possible overflow). Float elements will be casted to Int

Link copied to clipboard

Returns element as a IntArray, converting scalar types when possible.

Link copied to clipboard

Returns a minified version of this FlexBuffer as a JSON.

Link copied to clipboard
fun toKey(): Key

Returns element as Key or invalid key.

Link copied to clipboard
fun toLong(): Long

Returns element as Long. For vector types, it will return size of the vector For String type, it will type to be parsed as integer Unsigned elements will become negative Float elements will be casted to integer

Link copied to clipboard

Returns element as a LongArray, converting scalar types when possible.

Link copied to clipboard
fun toMap(): Map

Returns element as a Map.

Link copied to clipboard
fun toShort(): Short

Returns element as Short. For vector types, it will return size of the vector. For String type, it will type to be parsed as integer. Unsigned elements will become signed (with possible overflow). Float elements will be casted to Short

Link copied to clipboard

Returns element as a ByteArray, converting scalar types when possible.

Link copied to clipboard
open override fun toString(): String

Returns element as a String

Link copied to clipboard
fun toUByte(): UByte

Returns element as UByte. For vector types, it will return size of the vector. For String type, it will type to be parsed as integer. Negative elements will become unsigned counterpart. Float elements will be casted to UByte

Link copied to clipboard

Returns element as a UByteArray, converting scalar types when possible.

Link copied to clipboard
fun toUInt(): UInt

Returns element as UInt. For vector types, it will return size of the vector. For String type, it will type to be parsed as integer. Negative elements will become unsigned counterpart. Float elements will be casted to UInt

Link copied to clipboard

Returns element as a UIntArray, converting scalar types when possible.

Link copied to clipboard
fun toULong(): ULong

Returns element as ULong integer. For vector types, it will return size of the vector For String type, it will type to be parsed as integer Negative elements will become unsigned counterpart. Float elements will be casted to integer

Link copied to clipboard

Returns element as a ULongArray, converting scalar types when possible.

Link copied to clipboard

Returns element as UShort. For vector types, it will return size of the vector. For String type, it will type to be parsed as integer. Negative elements will become unsigned counterpart. Float elements will be casted to UShort

Link copied to clipboard

Returns element as a UIntArray, converting scalar types when possible.

Link copied to clipboard

Returns element as a Vector