Skip to main content

Class: TypedArrayCodec

Serialization.TypedArrayCodec()

JSON format codec for typed arrays

Constructor

new TypedArrayCodec()

Since:

  • version 3.0

Methods

(static) decode(data) → {TypedArray}

Parameters:
NameTypeDescription
dataSerialization.TypedArrayCodec.DataDescriptor
Returns:

Decoded data

Type

TypedArray

(static) encode(data, encodingopt, ArrayTypeopt) → Serialization.TypedArrayCodec.DataDescriptor

Parameters:
NameTypeAttributesDefaultDescription
dataTypedArray|Array.<Number>
encodingSerialization.TypedArrayCodec.Encoding<optional>AUTOEncoding type
ArrayTypeClass.<TypedArray><optional>When data is Array instance, data type
Returns:

Encoded data

Type

Serialization.TypedArrayCodec.DataDescriptor

(static) isTypedArrayData(data) → {boolean}

TypedArrayCodec.DataDescriptor validator

Parameters:
NameTypeDescription
dataSerialization.TypedArrayCodec.DataDescriptor
Returns:

Is provided data is DataDescriptor

Type

boolean

Type Definitions

DataDescriptor

TypedArray encoding descriptor

Properties:
NameTypeDescription
encodingSerialization.TypedArrayCodec.Encodingname as string
typeTypedArrayTypedArray name as string
pointsanyTypedArray values, where type depends from encoding

Encoding

TypedArray serialization options

Properties:
NameTypeDescription
AUTOobjectCheck for Buffer support and defaults to BUFFER else when SharedArrayBuffer backs TypedArray is NONE else ARRAY
NONEobjectThere is no content transform
ARRAYobjectPlain array from floats
BUFFERobjectBuffer.toJSON is used
BASE64objectBuffer.toString("base64") is used

Home