private Connection open(Path path, Path unzippedDir) throws IOException, SQLException {
    String uri = "jdbc:sqlite:" + path.toAbsolutePath();
    if (FileUtils.hasExtension(path, "zip")) {
      try (var zipFs = FileSystems.newFileSystem(path)) {
        var zipEntry = FileUtils.walkFileSystem(zipFs)
          .filter(Files::isRegularFile)
          .filter(entry -> FileUtils.hasExtension(entry, "sqlite"))
          .findFirst()
          .orElseThrow(() -> new IllegalArgumentException("No .sqlite file found inside " + path));
        extracted = unzippedDir.resolve(URLEncoder.encode(zipEntry.toString(), StandardCharsets.UTF_8));
        if (!extracted.startsWith(unzippedDir)) {
          throw new IllegalArgumentException(
            "Zip file tried to extract child outside of folder: " + zipEntry.getFileName());
        }
        FileUtils.createParentDirectories(extracted);
        if (!keepUnzipped || FileUtils.isNewer(path, extracted)) {
          LOGGER.info("unzipping {} to {}", path.toAbsolutePath(), extracted);
          FileUtils.safeCopy(Files.newInputStream(zipEntry), extracted);
        }
        if (!keepUnzipped) {
          extracted.toFile().deleteOnExit();
        }
      }
      uri = "jdbc:sqlite:" + extracted.toAbsolutePath();
    }
    return DriverManager.getConnection(uri);
  }
Returns a JDBC connection to the sqlite file. Input can be the sqlite file itself or a zip file containing it.
planetiler-core/src/main/java/com/onthegomap/planetiler/reader/NaturalEarthReader.java