private static @NotNull File downloadFile(final @NotNull DownloadableFileDescription description,
                                            final @NotNull File existingFile,
                                            final @NotNull ProgressIndicator indicator) throws IOException {
    final String presentableUrl = description.getPresentableDownloadUrl();
    indicator.setText(IdeCoreBundle.message("progress.connecting.to.download.file.text", presentableUrl));

    return HttpRequests.request(description.getDownloadUrl()).connect(new HttpRequests.RequestProcessor<>() {
      @Override
      public File process(@NotNull HttpRequests.Request request) throws IOException {
        int size = request.getConnection().getContentLength();
        if (existingFile.exists() && size == existingFile.length()) {
          return existingFile;
        }

        indicator.setText(IdeCoreBundle.message("progress.download.file.text", description.getPresentableFileName(), presentableUrl));
        return request.saveToFile(FileUtil.createTempFile("download.", ".tmp"), indicator);
      }
    });
  }
private static @NotNull File downloadFile(final @NotNull DownloadableFileDescription description,
                                            final @NotNull File existingFile,
                                            final @NotNull ProgressIndicator indicator)