public Map<String, DownUpResult> uploadContent(
      @NotNull final Map<String, String> dataIdToDownloadURLMap,
      @NotNull final List<AuthorizeUploadResponse> authorizeUploadResponseList) {
    final Map<String, DownUpResult> dataIdToUploadResponseMap = new HashMap<>();
    for (AuthorizeUploadResponse authorizeUploadResponse : authorizeUploadResponseList) {
      final String dataId = authorizeUploadResponse.getDataId();
      final String downloadURL = dataIdToDownloadURLMap.get(dataId);
      try (final StreamingContentClient downloadClient =
              new StreamingContentClient(
                  downloadURL, StreamingContentClient.StreamingMode.DOWNLOAD, monitor);
          final StreamingContentClient uploadClient =
              new StreamingContentClient(
                  authorizeUploadResponse.getUploadUrl(),
                  StreamingContentClient.StreamingMode.UPLOAD,
                  monitor)) {

        final int maxRequestBytes = ApplePhotosConstants.contentRequestLength;
        int totalSize = 0;
        for (byte[] data = downloadClient.downloadBytes(maxRequestBytes);
            data != null;
            data = downloadClient.downloadBytes(maxRequestBytes)) {
          totalSize += data.length;

          if (totalSize > ApplePhotosConstants.maxMediaTransferByteSize) {
            uploadClient.completeUpload();
            throw new AppleContentException(getApplePhotosImportThrowingMessage("file too large to import to Apple", ImmutableMap.of(
                    AuditKeys.dataId, Optional.of(dataId),
                    AuditKeys.downloadURL, Optional.of(downloadURL),
                    AuditKeys.uploadUrl, Optional.of(authorizeUploadResponse.getUploadUrl()))));
          }

          uploadClient.uploadBytes(data);
          if (data.length < maxRequestBytes) {
            break;
          }
        }
        final String singleFileUploadResponse = uploadClient.completeUpload();
        dataIdToUploadResponseMap.put(dataId, DownUpResult.ofDataId(singleFileUploadResponse));
      } catch (AppleContentException e) {
        dataIdToUploadResponseMap.put(dataId, DownUpResult.ofError(e));
      }
    }
    return dataIdToUploadResponseMap;
  }
An interface that is synonymous to HTTP client to interact with the Apple Photos APIs.
extensions/data-transfer/portability-data-transfer-apple/src/main/java/org/datatransferproject/datatransfer/apple/photos/AppleMediaInterface.java