Options
All
  • Public
  • Public/Protected
  • All
Menu

A subclass of Serializer that serializes TypedArray (in particular Buffer) and DataView objects as host objects, and only stores the part of their underlying ArrayBuffers that they are referring to.

Hierarchy

Index

Methods

releaseBuffer

  • Returns the stored internal buffer. This serializer should not be used once the buffer is released. Calling this method results in undefined behavior if a previous write has failed.

    Returns Buffer

transferArrayBuffer

  • transferArrayBuffer(id: number, arrayBuffer: ArrayBuffer): void
  • Marks an ArrayBuffer as having its contents transferred out of band.
    Pass the corresponding ArrayBuffer in the deserializing context to deserializer.transferArrayBuffer().

    Parameters

    • id: number
    • arrayBuffer: ArrayBuffer

    Returns void

writeDouble

  • writeDouble(value: number): void
  • Write a JS number value.

    Parameters

    • value: number

    Returns void

writeHeader

  • writeHeader(): void
  • Writes out a header, which includes the serialization format version.

    Returns void

writeRawBytes

  • Write raw bytes into the serializer’s internal buffer. The deserializer will require a way to compute the length of the buffer.

    Parameters

    Returns void

writeUint32

  • writeUint32(value: number): void
  • Write a raw 32-bit unsigned integer.

    Parameters

    • value: number

    Returns void

writeUint64

  • writeUint64(hi: number, lo: number): void
  • Write a raw 64-bit unsigned integer, split into high and low 32-bit parts.

    Parameters

    • hi: number
    • lo: number

    Returns void

writeValue

  • writeValue(val: any): boolean
  • Serializes a JavaScript value and adds the serialized representation to the internal buffer. This throws an error if value cannot be serialized.

    Parameters

    • val: any

    Returns boolean

Generated using TypeDoc