Options
All
  • Public
  • Public/Protected
  • All
Menu

Class LongType

A type storing an 8-byte signed integer (-9223372036854775808 to 9223372036854775807). Each value must be provided as a BigInt.

Example:

let type = new sb.LongType

Hierarchy

  • IntegerType<bigint>
    • LongType

Index

Constructors

constructor

  • Returns LongType

Accessors

Static _value

  • get _value(): number

Methods

addToBuffer

consumeValue

  • consumeValue(buffer: ArrayBuffer, offset: number): ReadResult<bigint>
  • Parameters

    • buffer: ArrayBuffer
    • offset: number

    Returns ReadResult<bigint>

equals

  • equals(otherType: unknown): boolean
  • Parameters

    • otherType: unknown

    Returns boolean

getHash

  • getHash(): string

getSignature

  • getSignature(): string

Private isBuffer

Private isSameType

  • isSameType(otherType: unknown): otherType is LongType
  • Determines whether the input is a Type with the same class

    Parameters

    • otherType: unknown

      A value, usually a Type instance

    Returns otherType is LongType

    whether this and otherType are instances of the same Type class

readValue

  • readValue(valueBuffer: ArrayBuffer | Uint8Array, offset?: number): bigint
  • Parameters

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

    Returns bigint

toBuffer

  • toBuffer(): ArrayBuffer

valueBuffer

  • valueBuffer(value: bigint): ArrayBuffer
  • Parameters

    • value: bigint

    Returns ArrayBuffer

writeValue

  • Appends value bytes to an AppendableBuffer according to the type

    Example:

    type.writeValue(buffer, -1234567890123456789n)
    
    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: bigint

      The value to write

    Returns void

Generated using TypeDoc