DefaultSerializer

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.

Since

v8.0.0

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard

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.

Link copied to clipboard
fun transferArrayBuffer(id: Number, arrayBuffer: ArrayBuffer)

Marks an ArrayBuffer as having its contents transferred out of band. Pass the corresponding ArrayBuffer in the deserializing context to deserializer.transferArrayBuffer().

Link copied to clipboard
fun writeDouble(value: Number)

Write a JS number value. For use inside of a custom serializer._writeHostObject().

Link copied to clipboard

Writes out a header, which includes the serialization format version.

Link copied to clipboard
fun writeRawBytes(buffer: TypedArray<*, *>)

Write raw bytes into the serializer's internal buffer. The deserializer will require a way to compute the length of the buffer. For use inside of a custom serializer._writeHostObject().

Link copied to clipboard
fun writeUint32(value: Number)

Write a raw 32-bit unsigned integer. For use inside of a custom serializer._writeHostObject().

Link copied to clipboard
fun writeUint64(hi: Number, lo: Number)

Write a raw 64-bit unsigned integer, split into high and low 32-bit parts. For use inside of a custom serializer._writeHostObject().

Link copied to clipboard
fun writeValue(value: Any?): Boolean

Serializes a JavaScript value and adds the serialized representation to the internal buffer.