MCPcopy Create free account
hub / github.com/LibPDF-js/core / readFixedDigits

Method readFixedDigits

src/parser/xref-parser.ts:433–448  ·  view source on GitHub ↗

* Read a fixed number of digits as an integer.

(count: number)

Source from the content-addressed store, hash-verified

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).

Callers 1

parseEntryMethod · 0.95

Calls 2

advanceMethod · 0.80
peekMethod · 0.45

Tested by

no test coverage detected