/** * StreamingBuffer - Continuous buffer for network message parsing * * Matches vanilla Quake 2's net_message buffer architecture from: * - /home/user/quake2/full/qcommon/msg.c (MSG_Read* functions) * - /home/user/quake2/full/client/cl_main.c:1798-1799 (buffer initialization) * * Maintains a continuous stream buffer that can be incrementally filled with * data from demo blocks or network packets, while preserving read position * for stateful parsing. */ export declare class StreamingBuffer { private buffer; private readOffset; private writeOffset; private static readonly INITIAL_SIZE; private static readonly MAX_STRING_LENGTH; constructor(initialCapacity?: number); /** * Append new data to the buffer (for demos: append blocks; for network: append packets) * Grows buffer if needed to accommodate new data. */ append(data: ArrayBuffer | Uint8Array): void; /** * Check if we have N bytes available from current read position */ hasBytes(count: number): boolean; /** * Get number of bytes available for reading */ available(): number; /** * Read one byte and advance position * Reference: MSG_ReadByte() in /home/user/quake2/full/qcommon/msg.c */ readByte(): number; /** * Read 2-byte short (little-endian) and advance position * Reference: MSG_ReadShort() in /home/user/quake2/full/qcommon/msg.c */ readShort(): number; /** * Read 4-byte long (little-endian) and advance position * Reference: MSG_ReadLong() in /home/user/quake2/full/qcommon/msg.c */ readLong(): number; /** * Read 4-byte float (little-endian) and advance position */ readFloat(): number; /** * Read null-terminated string and advance position * Reference: MSG_ReadString() in /home/user/quake2/full/qcommon/msg.c */ readString(): string; /** * Read raw bytes without advancing position (peek) */ peekBytes(count: number): Uint8Array; /** * Read raw bytes and advance position */ readBytes(count: number): Uint8Array; /** * Alias for readBytes to match tests */ readData(count: number): Uint8Array; /** * Get current read position (for debugging/state tracking) */ getReadPosition(): number; /** * Get current write position (for debugging/state tracking) */ getWritePosition(): number; /** * Set read position (use with caution - mainly for testing) */ setReadPosition(position: number): void; /** * Grow buffer to accommodate more data * Doubles current size or grows to required size, whichever is larger */ private grow; /** * Compact buffer - remove consumed data to free memory * Copies unread data to beginning of buffer and resets offsets * * Call this periodically when processing large streams to prevent * unbounded memory growth. */ compact(): void; /** * Get total buffer capacity */ getCapacity(): number; /** * Reset buffer to initial state (clear all data) */ reset(): void; } //# sourceMappingURL=streamingBuffer.d.ts.map