当前位置: 首页>>代码示例>>Java>>正文


Java TransferManager.appendMultipartUserAgent方法代码示例

本文整理汇总了Java中com.amazonaws.services.s3.transfer.TransferManager.appendMultipartUserAgent方法的典型用法代码示例。如果您正苦于以下问题:Java TransferManager.appendMultipartUserAgent方法的具体用法?Java TransferManager.appendMultipartUserAgent怎么用?Java TransferManager.appendMultipartUserAgent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.amazonaws.services.s3.transfer.TransferManager的用法示例。


在下文中一共展示了TransferManager.appendMultipartUserAgent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getNextUploadPartRequest

import com.amazonaws.services.s3.transfer.TransferManager; //导入方法依赖的package包/类
public synchronized UploadPartRequest getNextUploadPartRequest() {
    long partSize = Math.min(optimalPartSize, remainingBytes);
    boolean isLastPart = (remainingBytes - partSize <= 0);

    UploadPartRequest req = null;
    if (wrappedStream != null) {
        req = new UploadPartRequest()
            .withBucketName(bucketName)
            .withKey(key)
            .withUploadId(uploadId)
            .withInputStream(new InputSubstream(wrappedStream, 0, partSize, isLastPart))
            .withPartNumber(partNumber++)
            .withPartSize(partSize);
    } else {
        req = new UploadPartRequest()
            .withBucketName(bucketName)
            .withKey(key)
            .withUploadId(uploadId)
            .withFile(file)
            .withFileOffset(offset)
            .withPartNumber(partNumber++)
            .withPartSize(partSize);
    }
    req.withRequesterPays(origReq.isRequesterPays());
    TransferManager.appendMultipartUserAgent(req);

    if (sseCustomerKey != null) req.setSSECustomerKey(sseCustomerKey);

    offset += partSize;
    remainingBytes -= partSize;

    req.setLastPart(isLastPart);

    req.withGeneralProgressListener(origReq.getGeneralProgressListener())
       .withRequestMetricCollector(origReq.getRequestMetricCollector())
       ;
    req.getRequestClientOptions().setReadLimit(origReq.getReadLimit());
    return req;
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:40,代码来源:UploadPartRequestFactory.java

示例2: initiateMultipartUpload

import com.amazonaws.services.s3.transfer.TransferManager; //导入方法依赖的package包/类
/**
 * Initiates a multipart upload and returns the upload id
 * @param isUsingEncryption
 */
private String initiateMultipartUpload(PutObjectRequest origReq, boolean isUsingEncryption) {

    InitiateMultipartUploadRequest req = null;
    if (isUsingEncryption && origReq instanceof EncryptedPutObjectRequest) {
        req = new EncryptedInitiateMultipartUploadRequest(
                origReq.getBucketName(), origReq.getKey()).withCannedACL(
                origReq.getCannedAcl()).withObjectMetadata(origReq.getMetadata());
        ((EncryptedInitiateMultipartUploadRequest) req)
                .setMaterialsDescription(((EncryptedPutObjectRequest) origReq).getMaterialsDescription());
    } else {
        req = new InitiateMultipartUploadRequest(origReq.getBucketName(), origReq.getKey())
            .withCannedACL(origReq.getCannedAcl())
            .withObjectMetadata(origReq.getMetadata());
    }

    TransferManager.appendMultipartUserAgent(req);

    req.withAccessControlList(origReq.getAccessControlList())
       .withRequesterPays(origReq.isRequesterPays())
       .withStorageClass(origReq.getStorageClass())
       .withRedirectLocation(origReq.getRedirectLocation())
       .withSSECustomerKey(origReq.getSSECustomerKey())
       .withSSEAwsKeyManagementParams(origReq.getSSEAwsKeyManagementParams())
       .withGeneralProgressListener(origReq.getGeneralProgressListener())
       .withRequestMetricCollector(origReq.getRequestMetricCollector())
       ;

    String uploadId = s3.initiateMultipartUpload(req).getUploadId();
    log.debug("Initiated new multipart upload: " + uploadId);

    return uploadId;
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:37,代码来源:UploadCallable.java


注:本文中的com.amazonaws.services.s3.transfer.TransferManager.appendMultipartUserAgent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。