Class: TypedArrayCodec
Serialization.TypedArrayCodec()
JSON format codec for typed arrays
Constructor
new TypedArrayCodec()
Since:
- version 3.0
Methods
(static) decode(data) → {TypedArray}
Parameters:
Name | Type | Description |
---|---|---|
data | Serialization.TypedArrayCodec.DataDescriptor |
Returns:
Decoded data
Type
TypedArray
(static) encode(data, encodingopt, ArrayTypeopt) → Serialization.TypedArrayCodec.DataDescriptor
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
data | TypedArray|Array.<Number> | |||
encoding | Serialization.TypedArrayCodec.Encoding | <optional> | AUTO | Encoding type |
ArrayType | Class.<TypedArray> | <optional> | When data is Array instance, data type |
Returns:
Encoded data
Type
Serialization.TypedArrayCodec.DataDescriptor
(static) isTypedArrayData(data) → {boolean}
TypedArrayCodec.DataDescriptor validator
Parameters:
Name | Type | Description |
---|---|---|
data | Serialization.TypedArrayCodec.DataDescriptor |
Returns:
Is provided data is DataDescriptor
Type
boolean
Type Definitions
DataDescriptor
TypedArray encoding descriptor
Properties:
Name | Type | Description |
---|---|---|
encoding | Serialization.TypedArrayCodec.Encoding | name as string |
type | TypedArray | TypedArray name as string |
points | any | TypedArray values, where type depends from encoding |
Encoding
TypedArray serialization options
Properties:
Name | Type | Description |
---|---|---|
AUTO | object | Check for Buffer support and defaults to BUFFER else when SharedArrayBuffer backs TypedArray is NONE else ARRAY |
NONE | object | There is no content transform |
ARRAY | object | Plain array from floats |
BUFFER | object | Buffer.toJSON is used |
BASE64 | object | Buffer.toString("base64") is used |