Options
All
  • Public
  • Public/Protected
  • All
Menu

Class BooleanTupleType

A type storing a fixed-length array of Boolean values. This type creates more efficient serializations than new sb.TupleType({type: new sb.BooleanType}) for boolean tuples, since it works with bits instead of whole bytes.

Example:

let type = new sb.BooleanTupleType(100)

Hierarchy

  • AbsoluteType<boolean[]>
    • BooleanTupleType

Index

Constructors

constructor

Properties

Readonly length

length: number

Accessors

Static _value

  • get _value(): number

Methods

addToBuffer

consumeValue

  • consumeValue(buffer: ArrayBuffer, offset: number): ReadResult<boolean[]>
  • Parameters

    • buffer: ArrayBuffer
    • offset: number

    Returns ReadResult<boolean[]>

equals

  • equals(otherType: unknown): boolean

getHash

  • getHash(): string

getSignature

  • getSignature(): string

Private isBuffer

Private isSameType

  • Determines whether the input is a Type with the same class

    Parameters

    • otherType: unknown

      A value, usually a Type instance

    Returns otherType is BooleanTupleType

    whether this and otherType are instances of the same Type class

readValue

  • readValue(valueBuffer: ArrayBuffer | Uint8Array, offset?: number): boolean[]
  • Parameters

    • valueBuffer: ArrayBuffer | Uint8Array
    • offset: number = 0

    Returns boolean[]

toBuffer

  • toBuffer(): ArrayBuffer

valueBuffer

  • valueBuffer(value: boolean[]): ArrayBuffer
  • Parameters

    • value: boolean[]

    Returns ArrayBuffer

writeValue

  • Appends value bytes to an AppendableBuffer according to the type

    Example:

    type.writeValue(buffer, new Array(100).fill(true)) //takes up 13 bytes
    
    throws

    If the value doesn't match the type, e.g. new sb.StringType().writeValue(buffer, 23)

    Parameters

    • buffer: AppendableBuffer

      The buffer to which to append

    • value: boolean[]

      The value to write

    Returns void

Generated using TypeDoc