()
| 303 | } |
| 304 | |
| 305 | #readEndianness() { |
| 306 | const II = 0x4949; |
| 307 | const MM = 0x4d4d; |
| 308 | const endianness = this.#reader.read(2); |
| 309 | if (endianness === II) { |
| 310 | this.#reader.littleEndian = true; |
| 311 | } else if (endianness === MM) { |
| 312 | this.#reader.littleEndian = false; |
| 313 | } else { |
| 314 | throw new Error("Invalid JPEG: Endianness marker not found."); |
| 315 | } |
| 316 | } |
| 317 | } |
| 318 | |
| 319 | class Jpeg { |