@Override
    public Iterator<OsmElement> next() {
      if (!hasNext()) {
        throw new NoSuchElementException();
      }
      try {
        var primitiveGroup = Osmformat.PrimitiveGroup.parseFrom(block.getPrimitivegroup(i++));
        return Iterators.concat(
          new DenseNodeIterator(primitiveGroup.getDense()),
          new NodeIterator(primitiveGroup.getNodesList()),
          new WayIterator(primitiveGroup.getWaysList()),
          new RelationIterator(primitiveGroup.getRelationsList())
        );
      } catch (InvalidProtocolBufferException e) {
        throw new FileFormatException("Unable to parse primitive group", e);
      }
    }
Decompresses and parses a header block of an OSM input file.
planetiler-core/src/main/java/com/onthegomap/planetiler/reader/osm/PbfDecoder.java