@Override
    public OsmElement.Relation next() {
      if (!hasNext()) {
        throw new NoSuchElementException();
      }
      var relation = relations.get(i++);
      int num = relation.getMemidsCount();

      List<OsmElement.Relation.Member> members = new ArrayList<>(num);

      long memberId = 0;
      for (int j = 0; j < num; j++) {
        memberId += relation.getMemids(j);
        var memberType = switch (relation.getTypes(j)) {
          case WAY -> OsmElement.Type.WAY;
          case NODE -> OsmElement.Type.NODE;
          case RELATION -> OsmElement.Type.RELATION;
        };
        members.add(new OsmElement.Relation.Member(
          memberType,
          memberId,
          fieldDecoder.decodeString(relation.getRolesSid(j))
        ));
      }

      // Add the bound object to the results.
      return new OsmElement.Relation(
        relation.getId(),
        buildTags(relation.getKeysCount(), relation::getKeys, relation::getVals),
        members,
        parseInfo(relation.getInfo())
      );
    }
Decompresses and parses a header block of an OSM input file.
planetiler-core/src/main/java/com/onthegomap/planetiler/reader/osm/PbfDecoder.java