FixedLengthArrayType<TType, TFixedLength> Interface
Package: @esfx/struct-type
Represents the constructor for a fixed-length TypedArray
Declaration
export interface FixedLengthArrayType<TType extends Type, TFixedLength extends number = number>
Properties
[InitType]
Declaration
[InitType]: TypedArray<TType, TFixedLength> | ArrayLike<InitType<TType>>;
Property Value
[RuntimeType]
Declaration
[RuntimeType]: TypedArray<TType, TFixedLength>;
Property Value
BYTES_PER_ELEMENT
The number of bytes per each element of the array.
Declaration
readonly BYTES_PER_ELEMENT: number;
Property Value
fixedLength
the fixed length of the array.
Declaration
readonly fixedLength: TFixedLength;
Property Value
prototype
Declaration
prototype: TypedArray<TType, TFixedLength>;
Property Value
SIZE
The number of bytes for the entire array.
Declaration
readonly SIZE: number;
Property Value
Methods
read(buffer, byteOffset, shared, byteOrder)
Reads an array of values value from the buffer. The resulting array value will be backed by its own buffer.
Declaration
read(buffer: ArrayBufferLike, byteOffset: number, shared?: boolean, byteOrder?: Endianness): TypedArray<TType, TFixedLength>;
Parameters
- buffer
- ArrayBufferLike
The ArrayBuffer
or SharedArrayBuffer
from which to read the array.
- byteOrder
- Endianness
The endianness to use when reading the array. If unspecified, the native byte order will be used.
Returns
read(buffer, byteOffset, length, shared, byteOrder)
Reads an array of values value from the buffer. The resulting array value will be backed by its own buffer.
Declaration
read(buffer: ArrayBufferLike, byteOffset: number, length?: number, shared?: boolean, byteOrder?: Endianness): TypedArray<TType, TFixedLength>;
Parameters
- buffer
- ArrayBufferLike
The ArrayBuffer
or SharedArrayBuffer
from which to read the array.
- byteOrder
- Endianness
The endianness to use when reading the array. If unspecified, the native byte order will be used.
Returns
toFixed(fixedLength)
Gets a fixed-length subtype for this array type.
Declaration
toFixed<TFixedLength extends number>(fixedLength: TFixedLength): FixedLengthArrayType<TType, TFixedLength>;
Type Parameters
- TFixedLength
Parameters
- fixedLength
- TFixedLength
Returns
write(buffer, byteOffset, value, byteOrder)
Writes a structured value to a buffer.
Declaration
write(buffer: ArrayBufferLike, byteOffset: number, value: TypedArray<TType, TFixedLength>, byteOrder?: Endianness): void;
Parameters
- buffer
- ArrayBufferLike
The ArrayBuffer
or SharedArrayBuffer
into which to write the value.
- byteOrder
- Endianness
The endianness to use when writing the value. If unspecified, the native byte order will be used.
Returns