read static method
Implementation
static UPdfIndex read(UDocCursor cursor) {
if (cursor.remaining < 2) return UPdfIndex(const <int>[], Uint8List(0), cursor.position);
final int count = cursor.u16();
if (count == 0) return UPdfIndex(const <int>[], Uint8List(0), cursor.position);
final int offSize = cursor.u8();
if (offSize < 1 || offSize > 4) return UPdfIndex(const <int>[], Uint8List(0), cursor.position);
final List<int> offsets = <int>[];
for (int i = 0; i <= count; i++) {
int value = 0;
for (int b = 0; b < offSize; b++) {
value = (value << 8) | cursor.u8();
}
offsets.add(value - 1);
}
final int base = cursor.position;
final int last = offsets.isEmpty ? 0 : offsets.last;
final int end = base + last;
final Uint8List data = Uint8List.sublistView(cursor.bytes, base, end > cursor.bytes.length ? cursor.bytes.length : end);
return UPdfIndex(offsets, data, end);
}