(len: number)
| 206 | } |
| 207 | |
| 208 | stringUtf8(len: number) { |
| 209 | if (len < 0 || len > this.byteLength - this.cursor) { |
| 210 | throw new Error("Insufficient bytes for UTF-8 string"); |
| 211 | } |
| 212 | const end = this.cursor + len; |
| 213 | // JavaScript intentionally preserves platform UTF-8 replacement behavior; Rust is the runtime |
| 214 | // that provides checked UTF-8 string reads by default. |
| 215 | const result = this.platformBuffer.toString("utf8", this.cursor, end); |
| 216 | this.cursor += len; |
| 217 | return result; |
| 218 | } |
| 219 | |
| 220 | stringUtf16LE(len: number) { |
| 221 | if (len < 0 || len > this.byteLength - this.cursor) { |
no test coverage detected