API Reference > bentleyjs-core > Utils > ByteStream ByteStream Class Allows the contents of an ArrayBuffer to be consumed sequentially using methods to extract data of a particular type from the bytes beginning at the current read position. Methods and properties beginning with 'next' consume data at the current read position and advance it by the size of the data read. The read position can also be directly adjusted by the caller. Methods Name Description constructor(buffer: ArrayBuffer | SharedArrayBuffer, subView?: { byteLength: number, byteOffset: number }): ByteStream Construct a new ByteStream with the read position set to the beginning. advance(numBytes: number): boolean Adds the specified number of bytes to the current read position nextBytes(numBytes: number): Uint8Array Read the specified number of bytes beginning at the current read position into a Uint8Array and advance by the specified number of byte. nextUint32s(numUint32s: number): Uint32Array Read the specified number of unsigned 32-bit integers from the current read position and advance the read position. readBytes(readPos: number, numBytes: number): Uint8Array Read the specified number of bytes at the specified offset without changing the read position. reset(): void Resets the current read position to the beginning of the stream rewind(numBytes: number): boolean Subtracts the specified number of bytes from the current read position Properties Name Type Description arrayBuffer Accessor ReadOnly ArrayBuffer | SharedArrayBuffer Returns the underlying array buffer curPos Accessor number The current read position as an index into the stream of bytes. isPastTheEnd Accessor ReadOnly boolean Returns true if the current read position has been advanced past the end of the stream length Accessor ReadOnly number The number of bytes in this stream nextFloat32 Accessor ReadOnly number Read a 32-bit floating point number from the current read position and advance by 4 bytes. nextFloat64 Accessor ReadOnly number Read a 64-bit floating point number from the current read position and advance by 8 bytes. nextId64 Accessor ReadOnly string Read an unsigned 64-bit integer from the current read position, advance by 8 bytes, and return the 64-bit value as an Id64String. nextInt32 Accessor ReadOnly number Read a signed 32-bit integer from the current read position and advance by 4 bytes. nextUint16 Accessor ReadOnly number Read an unsigned 16-bit integer from the current read position and advance by 2 bytes. nextUint32 Accessor ReadOnly number Read an unsigned 32-bit integer from the current read position and advance by 4 bytes. nextUint8 Accessor ReadOnly number Read a unsigned 8-bit integer from the current read position and advance by 1 byte. Defined in core/bentley/src/ByteStream.ts Line 19 Last Updated: 12 June, 2024