本文整理汇总了Java中com.amazonaws.services.s3.transfer.model.UploadResult.setVersionId方法的典型用法代码示例。如果您正苦于以下问题:Java UploadResult.setVersionId方法的具体用法?Java UploadResult.setVersionId怎么用?Java UploadResult.setVersionId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.amazonaws.services.s3.transfer.model.UploadResult
的用法示例。
在下文中一共展示了UploadResult.setVersionId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: call
import com.amazonaws.services.s3.transfer.model.UploadResult; //导入方法依赖的package包/类
@Override
public UploadResult call() throws Exception {
CompleteMultipartUploadResult res;
try {
CompleteMultipartUploadRequest req = new CompleteMultipartUploadRequest(
origReq.getBucketName(), origReq.getKey(), uploadId,
collectPartETags())
.withRequesterPays(origReq.isRequesterPays())
.withGeneralProgressListener(origReq.getGeneralProgressListener())
.withRequestMetricCollector(origReq.getRequestMetricCollector())
;
res = s3.completeMultipartUpload(req);
} catch (Exception e) {
publishProgress(listener, ProgressEventType.TRANSFER_FAILED_EVENT);
throw e;
}
UploadResult uploadResult = new UploadResult();
uploadResult.setBucketName(origReq
.getBucketName());
uploadResult.setKey(origReq.getKey());
uploadResult.setETag(res.getETag());
uploadResult.setVersionId(res.getVersionId());
monitor.uploadComplete();
return uploadResult;
}
示例2: uploadInOneChunk
import com.amazonaws.services.s3.transfer.model.UploadResult; //导入方法依赖的package包/类
/**
* Uploads the given request in a single chunk and returns the result.
*/
private UploadResult uploadInOneChunk() {
PutObjectResult putObjectResult = s3.putObject(origReq);
UploadResult uploadResult = new UploadResult();
uploadResult.setBucketName(origReq.getBucketName());
uploadResult.setKey(origReq.getKey());
uploadResult.setETag(putObjectResult.getETag());
uploadResult.setVersionId(putObjectResult.getVersionId());
return uploadResult;
}
示例3: uploadPartsInSeries
import com.amazonaws.services.s3.transfer.model.UploadResult; //导入方法依赖的package包/类
/**
* Uploads all parts in the request in serial in this thread, then completes
* the upload and returns the result.
*/
private UploadResult uploadPartsInSeries(UploadPartRequestFactory requestFactory) {
final List<PartETag> partETags = new ArrayList<PartETag>();
while (requestFactory.hasMoreRequests()) {
if (threadPool.isShutdown()) throw new CancellationException("TransferManager has been shutdown");
UploadPartRequest uploadPartRequest = requestFactory.getNextUploadPartRequest();
// Mark the stream in case we need to reset it
InputStream inputStream = uploadPartRequest.getInputStream();
if (inputStream != null && inputStream.markSupported()) {
if (uploadPartRequest.getPartSize() >= Integer.MAX_VALUE) {
inputStream.mark(Integer.MAX_VALUE);
} else {
inputStream.mark((int)uploadPartRequest.getPartSize());
}
}
partETags.add(s3.uploadPart(uploadPartRequest).getPartETag());
}
CompleteMultipartUploadRequest req =
new CompleteMultipartUploadRequest(
origReq.getBucketName(), origReq.getKey(), multipartUploadId,
partETags)
.withRequesterPays(origReq.isRequesterPays())
.withGeneralProgressListener(origReq.getGeneralProgressListener())
.withRequestMetricCollector(origReq.getRequestMetricCollector())
;
CompleteMultipartUploadResult res = s3.completeMultipartUpload(req);
UploadResult uploadResult = new UploadResult();
uploadResult.setBucketName(res.getBucketName());
uploadResult.setKey(res.getKey());
uploadResult.setETag(res.getETag());
uploadResult.setVersionId(res.getVersionId());
return uploadResult;
}