Construct an input stream from a Uint8Array
The source Uint8Array.
The buffer to read from
The number of bytes in the buffer
The current reading position
Returns the next byte in the input stream, without extracting it.
The byte that was read, or -1 if the stream is exhausted.
Read one byte.
The byte that was read, or -1 if the stream is exhausted.
Read a signed, big-endian 32-bit integer.
the number that has been read.
Read a signed, big-endian 64-bit long.
the number that has been read.
Read a signed 8-bit integer.
the number that has been read.
Read a specified amount of bytes.
If the length is greater than the remaining number of bytes, this function will read up to the last available byte in the buffer.
the number of bytes you wish to read.
the bytes that have been read
Read until a specified byte (delimiter) is found.
The buffer position is updated to point to just after the delimiter.
If the delimiter can't be found, then return all bytes until the end of the buffer.
the delimiter byte
a buffer containing the bytes up to but not including the delimiter byte.
Copyright © 2025 DiffusionData Ltd. All Rights Reserved.
Sequential reading of values from a given Uint8Array. Loosely inspired by Java's ByteArrayInputStream.