code: private URI initiateResumableUpload(URI batchJobUploadUrl) throws BatchJobException {
      // This follows the Google Cloud Storage guidelines for initiating resumable uploads:
      // https://cloud.google.com/storage/docs/resumable-uploads-xml
      HttpRequestFactory requestFactory =
          httpTransport.createRequestFactory(
              req -> {
                HttpHeaders headers = createHttpHeaders();
                headers.setContentLength(0L);
                headers.set("x-goog-resumable", "start");
                req.setHeaders(headers);
                req.setLoggingEnabled(true);
              });
  
      try {
        HttpRequest httpRequest =
            requestFactory.buildPostRequest(new GenericUrl(batchJobUploadUrl), new EmptyContent());
        HttpResponse response = httpRequest.execute();
        if (response.getHeaders() == null || response.getHeaders().getLocation() == null) {
          throw new BatchJobException(
              "Initiate upload failed. Resumable upload URI was not in the response.");
        }
        return URI.create(response.getHeaders().getLocation());
      } catch (IOException e) {
        throw new BatchJobException("Failed to initiate upload", e);
      }
    }
docs: Initiates the resumable upload by sending a request to Google Cloud Storage.
  
  @param batchJobUploadUrl the {@code uploadUrl} of a {@code BatchJob}
  @return the URI for the initiated resumable upload