我正在使用带有Android API的Azure存储。我正在尝试将一个块blob从一个位置复制到另一个位置(在SAME 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);
}
关于可能出现什么问题的任何想法?
致以最诚挚的问候,
答案 0 :(得分:1)
请参阅以下有关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 */);
}