void loadWordIndex()

Load the word index of the pdb file. Only call this method explicitly when you want to eager load the word index. Otherwise this method will be lazy-loaded when necessary

Source

void loadWordIndex() {
  if (_wordIndexLoaded == true) return;

  PdbRecord r = _pdbAccess.readRecord(_wordIndex);
  int index = 0;
  Uint8List indexData = r.data;
  int totalIndexes = Util.readShort(indexData, index);
  index += 2;
  _wordLength = new List(totalIndexes);
  _totalWord = new List(totalIndexes);
  _compressed = new List(totalIndexes);

  for (int i = 0; i < totalIndexes; i++) {
    _wordLength[i] = Util.readShort(indexData, index);
    index += 2;
    _totalWord[i] = Util.readShort(indexData, index);
    index += 2;
    _compressed[i] = indexData[index++] != 0;
    index++;
  }

  int totalByteAcc = 0;
  _byteAcc = new List(totalIndexes + 1);
  _byteAcc[0] = 0;
  for (int i = 1; i <= totalIndexes; i++) {
    totalByteAcc += _totalWord[i - 1] * _wordLength[i - 1];
    _byteAcc[i] = totalByteAcc;
  }

  List<PdbRecord> records = new List(_totalWordRec);
  int totalLen = 0;
  for (int i = 0; i < _totalWordRec; i++) {
    records[i] = _pdbAccess.readRecord(_wordIndex + i + 1);
    totalLen += records[i].data.length;
  }

  _wordData = new Uint8List(totalLen);
  int l = 0;
  for (int i = 0; i < _totalWordRec; i++) {
    Uint8List d = records[i].data;
    _wordData.setRange(l, l + d.length, d);
    l += d.length;
    _pdbAccess.removeFromCache(_wordIndex + i + 1);
  }

  _wordIndexLoaded = true;
}