本文整理汇总了Java中com.amazonaws.services.s3.model.UploadPartResult.getPartETag方法的典型用法代码示例。如果您正苦于以下问题:Java UploadPartResult.getPartETag方法的具体用法?Java UploadPartResult.getPartETag怎么用?Java UploadPartResult.getPartETag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.amazonaws.services.s3.model.UploadPartResult
的用法示例。
在下文中一共展示了UploadPartResult.getPartETag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doUploadMultipart
import com.amazonaws.services.s3.model.UploadPartResult; //导入方法依赖的package包/类
protected PartETag doUploadMultipart(S3BlobStore blobStore, String bucketName, String blobName, String uploadId, InputStream is,
int length, boolean lastPart) throws AmazonS3Exception {
UploadPartRequest request = new UploadPartRequest()
.withBucketName(bucketName)
.withKey(blobName)
.withUploadId(uploadId)
.withPartNumber(multipartChunks)
.withInputStream(is)
.withPartSize(length)
.withLastPart(lastPart);
UploadPartResult response = blobStore.client().uploadPart(request);
return response.getPartETag();
}
示例2: call
import com.amazonaws.services.s3.model.UploadPartResult; //导入方法依赖的package包/类
public PartETag call()
/* */ throws Exception
/* */ {
/* 218 */ InputStream is = new ProgressableResettableBufferedFileInputStream(this.partFile, MultipartUploadOutputStream.this.progressable);
/* */
/* 220 */ UploadPartRequest request = new UploadPartRequest().withBucketName(MultipartUploadOutputStream.this.bucketName).withKey(MultipartUploadOutputStream.this.key).withUploadId(MultipartUploadOutputStream.this.uploadId).withInputStream(is).withPartNumber(this.partNumber).withPartSize(this.partFile.length()).withMD5Digest(this.md5sum);
/* */
/* 230 */ //MetricsSaver.StopWatch stopWatch = new MetricsSaver.StopWatch();
/* */ UploadPartResult result;
/* */ try
/* */ {
/* 232 */ String message = String.format("S3 uploadPart bucket:%s key:%s part:%d size:%d", new Object[] { MultipartUploadOutputStream.this.bucketName, MultipartUploadOutputStream.this.key, Integer.valueOf(this.partNumber), Long.valueOf(this.partFile.length()) });
/* */
/* 235 */ MultipartUploadOutputStream.LOG.info(message);
/* 236 */ result = MultipartUploadOutputStream.this.s3.uploadPart(request);
/* 237 */ //MetricsSaver.addValue("S3WriteDelay", stopWatch.elapsedTime());
/* 238 */ //MetricsSaver.addValue("S3WriteBytes", this.partFile.length());
/* */ } catch (Exception e) {
/* 240 */ //MetricsSaver.addValueWithError("S3WriteDelay", stopWatch.elapsedTime(), e);
/* 241 */ throw e;
/* */ } finally {
/* */ try {
/* 244 */ if (is != null)
/* 245 */ is.close();
/* */ }
/* */ finally {
/* 248 */ this.partFile.delete();
/* */ }
/* */ }
/* */
/* 252 */ return result.getPartETag();
/* */ }