private Stream<Tile> getTiles(List<Pmtiles.Entry> dir) {
    return dir.stream().mapMulti((entry, next) -> {
      try {
        if (entry.runLength == 0) {
          getTiles(readDir(header.leafDirectoriesOffset() + entry.offset(), entry.length())).forEach(next);
        } else {
          var data = getBytes(header.tileDataOffset() + entry.offset(), entry.length());
          for (int i = 0; i < entry.runLength(); i++) {
            next.accept(new Tile(TileCoord.hilbertDecode((int) (entry.tileId() + i)), data));
          }
        }
      } catch (IOException e) {
        throw new IllegalStateException("Failed to iterate through pmtiles archive ", e);
      }
    });
  }
Finds the relevant entry for a tileId in a list of entries.
<p>
If there is an exact match for tileId, return that. Else if the tileId matches an entry's tileId + runLength,
return that. Else if the preceding entry is a directory (runLength = 0), return that. Else return null.
planetiler-core/src/main/java/com/onthegomap/planetiler/pmtiles/ReadablePmtiles.java