init method

Future<void> init(
  1. bool strict,
  2. GeometryFactory gf
)

Implementation

Future<void> init(bool strict, GeometryFactory gf) async {
  geometryFactory = gf;

  // start small
  buffer = LByteBuffer(1024, doSigned: true);
  await fill(buffer, channel);

  buffer.flip();
  currentOffset = 0;

  header = ShapefileHeader();
  header.read(buffer, strict);
  fileShapeType = header.shapeType;
  handler = fileShapeType.getShapeHandler(gf);
  if (handler == null) {
    throw IOException("Unsuported shape type: $fileShapeType");
  }

  headerTransfer = LByteBuffer(8);
  headerTransfer.endian = Endian.big;

  // make sure the record end is set now...
  recordEnd = toFileOffset(buffer.position);
}