recordAt method
Sets the current location of the byteStream to offset and returns the next record. Usually used in conjuctions with the shx file or some other index file. Mind that:
- it's your responsibility to ensure the offset corresponds to the actual beginning of a shape struct
- once you call this, reading with hasNext/next on sparse shapefiles will be broken (we don't know anymore at which shape we are)
@param offset If using an shx file the offset would be: 2 * (index.getOffset(i)) @return The record after the offset location in the bytestream @ thrown in a read error occurs @throws UnsupportedOperationException thrown if not a random access file
Implementation
Future<Record?> recordAt(int offset) async {
if (randomAccessEnabled) {
await goTo(offset);
return await nextRecord();
}
throw StateError("Random Access not enabled");
}