constructor Method
Deprecated in 3.x. Use ByteStream.fromUint8Array or ByteStream.fromArrayBuffer.
Construct a new ByteStream with the read position set to the beginning.
ByteStream(buffer: ArrayBuffer | SharedArrayBuffer, subView?: { byteLength: number, byteOffset: number }): ByteStream
Parameter | Type | Description |
---|---|---|
buffer | ArrayBuffer | SharedArrayBuffer | The underlying buffer from which data is to be extracted. |
subView | { byteLength: number, byteOffset: number } | If defined, specifies the subset of the underlying buffer's data to use. This constructor is subject to two common mistakes: 1. Given bytes: Uint8Array , new ByteStream(bytes) will compile but at run-time will produce an error asserting thatthe DataView constructor requires an ArrayBuffer. The correct usage is new ByteStream(bytes.buffer) .2. Given bytes: Uint8Array , new ByteStream(bytes.buffer) creates a stream for the entire range of bytes represented by the underlyingArrayBuffer. If bytes represents only a sub-range of the underlying buffer's data, the results will be unexpected unless the optional subView argument is supplied, with correct offset and length. For both of the above reasons, prefer to use ByteStream.fromUint8Array. |
Returns - ByteStream
Defined in
- core/bentley/src/ByteStream.ts Line 38
Last Updated: 30 November, 2023