readIndex static method

int readIndex(
  1. Uint8List data,
  2. int offset,
  3. List<int> inds
)

Implementation

static int readIndex(Uint8List data, int offset, List<int> inds) {
  int count = TyprBin.readUshort(data, offset) + 1;
  offset += 2;
  int offsize = data[offset];
  offset++;

  if (offsize == 1)
    for (int i = 0; i < count; i++) inds.add(data[offset + i]);
  else if (offsize == 2)
    for (int i = 0; i < count; i++)
      inds.add(TyprBin.readUshort(data, offset + i * 2));
  else if (offsize == 3)
    for (int i = 0; i < count; i++)
      inds.add(TyprBin.readUint(data, offset + i * 3 - 1) & 0x00ffffff);
  else if (count != 1)
    throw "unsupported offset size: $offsize, count: $count";

  offset += count * offsize;
  return offset - 1;
}