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

Method readIntegerAt

src/parser/xref-parser.ts:547–565  ·  view source on GitHub ↗

* Read an integer at given position.

(pos: number)

Source from the content-addressed store, hash-verified

545 * Read an integer at given position.
546 */
547 private readIntegerAt(pos: number): number | null {
548 const bytes = this.scanner.bytes;
549 let value = 0;
550 let hasDigits = false;
551
552 while (pos < bytes.length) {
553 const byte = bytes[pos];
554
555 if (byte >= DIGIT_0 && byte <= DIGIT_9) {
556 value = value * 10 + (byte - DIGIT_0);
557 hasDigits = true;
558 pos++;
559 } else {
560 break;
561 }
562 }
563
564 return hasDigits ? value : null;
565 }
566
567 /**
568 * Read an integer from current scanner position.

Callers 1

findStartXRefMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected