/** * @fileoverview Bounds-checked binary cursor shared by every media probe. * Every read either returns the requested value or throws {@link TinyNeedMoreData}, * which is what makes the incremental parsing possible: the probe catches the * sentinel, keeps the buffered bytes and retries once the next chunk arrives. */ /** * Signals that the buffer does not hold enough bytes to satisfy a read. * It is a control-flow signal, not a failure. * @augments Error */ export declare class TinyNeedMoreData extends Error { /** * Exception thrown when the current buffer does not contain enough bytes to fulfill a read request. * @param {string} [message] - The error message. */ constructor(message?: string); } /** * A forward-only, bounds-checked cursor over a {@link Uint8Array}. */ export default class TinyBufferReader { #private; /** * Initializes a new bounds-checked binary reader. * @param {Uint8Array} bytes - The backing buffer. * @param {number} [offset] - The first readable byte. * @param {number} [limit] - The byte after the last readable byte. * @throws {TypeError} If `bytes` is not a Uint8Array. * @throws {RangeError} If `offset` or `limit` is out of bounds. */ constructor(bytes: Uint8Array, offset?: number, limit?: number); /** @returns {number} The absolute cursor position. */ get offset(): number; /** @returns {number} The byte after the last readable byte. */ get limit(): number; /** @returns {number} The number of readable bytes left. */ get remaining(): number; /** @returns {boolean} True when the cursor reached the limit. */ get eof(): boolean; /** @returns {Uint8Array} The full backing buffer. */ get buffer(): Uint8Array; /** * Checks if the buffer contains at least the specified number of readable bytes. * @param {number} count - The number of bytes to test. * @returns {boolean} True when at least `count` bytes are readable. * @throws {TypeError} If `count` is not an integer. */ has(count: number): boolean; /** * Moves the cursor to an absolute position in the buffer. * @param {number} position - The absolute position to move to. * @returns {TinyBufferReader} The current instance for chaining. * @throws {RangeError} If `position` is not a positive integer. */ seek(position: number): TinyBufferReader; /** * Skips a specified number of bytes in the buffer. * @param {number} count - The number of bytes to skip. * @returns {TinyBufferReader} The current instance for chaining. * @throws {TinyNeedMoreData} If fewer than `count` bytes are readable. */ skip(count: number): TinyBufferReader; /** * Reads the next unsigned 8-bit integer. * @returns {number} The next unsigned 8-bit integer. */ uint8(): number; /** * Reads the next unsigned 16-bit big-endian integer. * @returns {number} The next unsigned 16-bit big-endian integer. */ uint16(): number; /** * Reads the next unsigned 16-bit little-endian integer. * @returns {number} The next unsigned 16-bit little-endian integer. */ uint16le(): number; /** * Reads the next unsigned 24-bit big-endian integer. * @returns {number} The next unsigned 24-bit big-endian integer. */ uint24(): number; /** * Reads the next unsigned 32-bit big-endian integer. * @returns {number} The next unsigned 32-bit big-endian integer. */ uint32(): number; /** * Reads the next unsigned 32-bit little-endian integer. * @returns {number} The next unsigned 32-bit little-endian integer. */ uint32le(): number; /** * Reads the next signed 32-bit little-endian integer. * @returns {number} The next signed 32-bit little-endian integer. */ int32le(): number; /** * Reads an unsigned 64-bit big-endian integer as a Number. Values above 2^53 * lose precision, which is acceptable for the box sizes and offsets we read. * @returns {number} The decoded value. */ uint64(): number; /** * Reads a fixed-length string using Latin-1 encoding. * @param {number} length - The number of bytes to read. * @returns {string} The decoded Latin-1 string. */ ascii(length: number): string; /** * Extracts a view over a specified range of bytes from the buffer. * @param {number} length - The number of bytes to read. * @returns {Uint8Array} A view over the requested bytes. */ bytes(length: number): Uint8Array; } //# sourceMappingURL=TinyBufferReader.d.mts.map