是否可以将数据流式传输(上传)以存储在 Google 云存储的存储桶中并允许同时下载?

Is it possible to stream data(Upload) to store on bucket of Google cloud storage and allow to download at the same time?

是否可以将数据流式传输(上传)以存储在 Google 云存储的存储桶中并允许同时下载? 我尝试使用云 API 通过使用以下代码将 100MB 文件上传到存储桶,但是在上传过程中,我在 Google 云控制台中刷新存储桶,我看不到新的上传文件,直到上传完成。我想上传以 H.264 编码的实时视频以存储在云存储中,因此大小未知,同时其他用户可以开始下载它正在上传的文件事件。那有可能吗?

  Test code:

  File tempFile = new File("StorageSample");
  RandomAccessFile raf = new RandomAccessFile(tempFile, "rw");
  try
  {
      raf.setLength(1000 * 1000 * 100);
  }
  finally
  {
      raf.close();
  }

  uploadFile(TEST_FILENAME, "text/plain", tempFile, bucketName);

public static void uploadFile(
  String name, String contentType, File file, String bucketName)
  throws IOException, GeneralSecurityException 
{
    InputStreamContent contentStream = new InputStreamContent(
    contentType, new FileInputStream(file));
    // Setting the length improves upload performance
    contentStream.setLength(file.length());
    StorageObject objectMetadata = new StorageObject()
    // Set the destination object name
    .setName(name)
    // Set the access control list to publicly read-only
    .setAcl(Arrays.asList(
        new ObjectAccessControl().setEntity("allAuthenticatedUsers").setRole("READER"))); //allUsers//

    // Do the insert
    Storage client = StorageFactory.getService();
    Storage.Objects.Insert insertRequest = client.objects().insert(
    bucketName, objectMetadata, contentStream);   
    insertRequest.getMediaHttpUploader().setDirectUploadEnabled(false);  

    insertRequest.execute();
}

不幸的是,这是不可能的,因为 documentation:

Objects are immutable, which means that an uploaded object cannot change throughout its storage lifetime. An object's storage lifetime is the time between successful object creation (upload) and successful object deletion.

这意味着云存储中的对象在上传完成后开始存在,因此在上传未完成之前您无法访问该对象。