* Read a fixed number of digits as an integer.
(count: number)
| 431 | * Read a fixed number of digits as an integer. |
| 432 | */ |
| 433 | private readFixedDigits(count: number): number { |
| 434 | let value = 0; |
| 435 | |
| 436 | for (let i = 0; i < count; i++) { |
| 437 | const byte = this.scanner.peek(); |
| 438 | |
| 439 | if (byte < DIGIT_0 || byte > DIGIT_9) { |
| 440 | throw new XRefParseError(`Expected digit, got ${String.fromCharCode(byte)}`); |
| 441 | } |
| 442 | |
| 443 | value = value * 10 + (byte - DIGIT_0); |
| 444 | this.scanner.advance(); |
| 445 | } |
| 446 | |
| 447 | return value; |
| 448 | } |
| 449 | |
| 450 | /** |
| 451 | * Skip space characters (not newlines). |
no test coverage detected