android - Azure Blob 存储 - 在同一容器中复制 block Blob

标签 android azure

我正在将 Azure 存储与 Android API 结合使用。我正在尝试将一个 block blob 从一个位置复制到另一个位置(在同一个 blob 容器中)。

但是,当我进行复制时,在调用 startCopy 方法后出现“CannotVerifyCopySource”错误。

示例代码:

private void sample(String path1, String path2, File file) {

    CloudBlockBlob blob1 = container.getBlockBlobReference(path1);
    CloudBlockBlob blob2 = container.getBlockBlobReference(path2);

    blob1.upload(new FileInputStream(file), file.length());
    blob1.startCopy(blob2);
}

对可能出现的问题有什么想法吗?

最诚挚的问候,

最佳答案

请参阅下面有关 startCopy 的源代码。我认为你应该在这里使用 blob2.startCopy(blob1)

/**
     * Requests the service to start copying a block blob's contents, properties, and metadata to a new block blob.
     *
     * @param sourceBlob
     *            A <code>CloudBlockBlob</code> object that represents the source blob to copy.
     *
     * @return A <code>String</code> which represents the copy ID associated with the copy operation.
     *
     * @throws StorageException
     *             If a storage service error occurred.
     * @throws URISyntaxException
     */
    @DoesServiceRequest
    public final String startCopy(final CloudBlockBlob sourceBlob) throws StorageException, URISyntaxException {
        return this.startCopy(sourceBlob, null /* sourceAccessCondition */,
                null /* destinationAccessCondition */, null /* options */, null /* opContext */);
    }

关于android - Azure Blob 存储 - 在同一容器中复制 block Blob,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37411067/

相关文章:

java - SimonVT 菜单抽屉

android - 将可绘制对象添加到 CirclePageIndicator

android - 无法解析符号 Theme、ThemeOverlay

c# - 使用 Azure SDK C# 创建和删除可用性测试

azure - 如何将现有的 Azure 存储帐户连接到专用链接?

android - 如何在谷歌地图 V2 Android 上移动标记

android - Google Play 上不支持的设备

c# - 从 .Net Web API 中的 Azure 身份验证 AD 获取用户名

azure - 如何确定给定的 Azure DevOps PAT token 是否对所有可访问的组织都有效?

azure - 参数 securityEnabledOnly 必须是有效的 bool 值