我正在将 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/