本文整理汇总了Java中com.amazonaws.services.s3.model.CopyPartRequest类的典型用法代码示例。如果您正苦于以下问题:Java CopyPartRequest类的具体用法?Java CopyPartRequest怎么用?Java CopyPartRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CopyPartRequest类属于com.amazonaws.services.s3.model包,在下文中一共展示了CopyPartRequest类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: populateRequestWithCopyPartParameters
import com.amazonaws.services.s3.model.CopyPartRequest; //导入依赖的package包/类
/**
* <p>
* Populates the specified request with the numerous options available in
* <code>CopyObjectRequest</code>.
* </p>
*
* @param request
* The request to populate with headers to represent all the
* options expressed in the <code>CopyPartRequest</code> object.
* @param copyPartRequest
* The object containing all the options for copying an object in
* Amazon S3.
*/
private static void populateRequestWithCopyPartParameters(Request<?> request, CopyPartRequest copyPartRequest) {
String copySourceHeader =
"/" + SdkHttpUtils.urlEncode(copyPartRequest.getSourceBucketName(), true)
+ "/" + SdkHttpUtils.urlEncode(copyPartRequest.getSourceKey(), true);
if (copyPartRequest.getSourceVersionId() != null) {
copySourceHeader += "?versionId=" + copyPartRequest.getSourceVersionId();
}
request.addHeader("x-amz-copy-source", copySourceHeader);
addDateHeader(request, Headers.COPY_SOURCE_IF_MODIFIED_SINCE,
copyPartRequest.getModifiedSinceConstraint());
addDateHeader(request, Headers.COPY_SOURCE_IF_UNMODIFIED_SINCE,
copyPartRequest.getUnmodifiedSinceConstraint());
addStringListHeader(request, Headers.COPY_SOURCE_IF_MATCH,
copyPartRequest.getMatchingETagConstraints());
addStringListHeader(request, Headers.COPY_SOURCE_IF_NO_MATCH,
copyPartRequest.getNonmatchingETagConstraints());
if ( copyPartRequest.getFirstByte() != null && copyPartRequest.getLastByte() != null ) {
String range = "bytes=" + copyPartRequest.getFirstByte() + "-" + copyPartRequest.getLastByte();
request.addHeader(Headers.COPY_PART_RANGE, range);
}
// Populate the SSE-C parameters for the destination object
populateSourceSSE_C(request, copyPartRequest.getSourceSSECustomerKey());
populateSSE_C(request, copyPartRequest.getDestinationSSECustomerKey());
}
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:42,代码来源:AmazonS3Client.java
示例2: copyPartsInParallel
import com.amazonaws.services.s3.model.CopyPartRequest; //导入依赖的package包/类
/**
* Submits a callable for each part to be copied to our thread pool and
* records its corresponding Future.
*/
private void copyPartsInParallel(CopyPartRequestFactory requestFactory) {
while (requestFactory.hasMoreRequests()) {
if (threadPool.isShutdown())
throw new CancellationException(
"TransferManager has been shutdown");
CopyPartRequest request = requestFactory.getNextCopyPartRequest();
futures.add(threadPool.submit(new CopyPartCallable(s3, request)));
}
}
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:14,代码来源:CopyCallable.java
示例3: getNextCopyPartRequest
import com.amazonaws.services.s3.model.CopyPartRequest; //导入依赖的package包/类
/**
* Constructs a copy part requests and returns it.
*
* @return Returns a new copy part request
*/
public synchronized CopyPartRequest getNextCopyPartRequest() {
final long partSize = Math.min(optimalPartSize, remainingBytes);
CopyPartRequest req = new CopyPartRequest()
.withSourceBucketName(origReq.getSourceBucketName())
.withSourceKey(origReq.getSourceKey())
.withUploadId(uploadId)
.withPartNumber(partNumber++)
.withDestinationBucketName(origReq.getDestinationBucketName())
.withDestinationKey(origReq.getDestinationKey())
.withSourceVersionId(origReq.getSourceVersionId())
.withFirstByte(Long.valueOf(offset))
.withLastByte(Long.valueOf(offset + partSize - 1))
.withSourceSSECustomerKey(origReq.getSourceSSECustomerKey())
.withDestinationSSECustomerKey(origReq.getDestinationSSECustomerKey())
.withRequesterPays(origReq.isRequesterPays())
// other meta data
.withMatchingETagConstraints(origReq.getMatchingETagConstraints())
.withModifiedSinceConstraint(origReq.getModifiedSinceConstraint())
.withNonmatchingETagConstraints(origReq.getNonmatchingETagConstraints())
.withSourceVersionId(origReq.getSourceVersionId())
.withUnmodifiedSinceConstraint(origReq.getUnmodifiedSinceConstraint())
// general meta data
.withGeneralProgressListener(origReq.getGeneralProgressListener())
.withRequestMetricCollector(origReq.getRequestMetricCollector())
;
offset += partSize;
remainingBytes -= partSize;
return req;
}
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:36,代码来源:CopyPartRequestFactory.java
示例4: copyPartSecurely
import com.amazonaws.services.s3.model.CopyPartRequest; //导入依赖的package包/类
@Override
public final CopyPartResult copyPartSecurely(CopyPartRequest copyPartRequest) {
String uploadId = copyPartRequest.getUploadId();
T uploadContext = multipartUploadContexts.get(uploadId);
CopyPartResult result = s3.copyPart(copyPartRequest);
if (uploadContext != null && !uploadContext.hasFinalPartBeenSeen())
uploadContext.setHasFinalPartBeenSeen(true);
return result;
}
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:11,代码来源:S3CryptoModuleBase.java
示例5: copyPartSecurely
import com.amazonaws.services.s3.model.CopyPartRequest; //导入依赖的package包/类
@Override
public CopyPartResult copyPartSecurely(CopyPartRequest req) {
return defaultCryptoMode == EncryptionOnly
? eo.copyPartSecurely(req)
: ae.copyPartSecurely(req)
;
}
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:8,代码来源:CryptoModuleDispatcher.java
示例6: copyPart
import com.amazonaws.services.s3.model.CopyPartRequest; //导入依赖的package包/类
@Override
public CopyPartResult copyPart(CopyPartRequest copyPartRequest) throws AmazonClientException, AmazonServiceException {
return delegate.copyPart(copyPartRequest);
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:AmazonS3Wrapper.java
示例7: CopyPartCallable
import com.amazonaws.services.s3.model.CopyPartRequest; //导入依赖的package包/类
public CopyPartCallable(AmazonS3 s3, CopyPartRequest request) {
this.s3 = s3;
this.request = request;
}
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:5,代码来源:CopyPartCallable.java
示例8: copyPart
import com.amazonaws.services.s3.model.CopyPartRequest; //导入依赖的package包/类
@Override
public CopyPartResult copyPart(CopyPartRequest copyPartRequest) {
return crypto.copyPartSecurely(copyPartRequest);
}
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:5,代码来源:AmazonS3EncryptionClient.java
示例9: copyPart
import com.amazonaws.services.s3.model.CopyPartRequest; //导入依赖的package包/类
@Override
public CopyPartResult copyPart(CopyPartRequest copyPartRequest) {
return call(() -> getDelegate().copyPart(copyPartRequest));
}
开发者ID:HubSpot,项目名称:S3Decorators,代码行数:5,代码来源:S3Decorator.java
示例10: copyMultipartFile
import com.amazonaws.services.s3.model.CopyPartRequest; //导入依赖的package包/类
private CompleteMultipartUploadResult copyMultipartFile(Bucket srcBucket, Bucket targetBucket, String fileName,
long size) {
// Create lists to hold copy responses
List<CopyPartResult> copyResponses =
new ArrayList<CopyPartResult>();
// Step 2: Initialize
InitiateMultipartUploadRequest initiateRequest =
new InitiateMultipartUploadRequest(targetBucket.getName(), targetBucket.getPath() + SEPARATOR + fileName);
InitiateMultipartUploadResult initResult =
s3Client.initiateMultipartUpload(initiateRequest);
// Step 4. Copy parts.
long partSize = 5 * (long)Math.pow(2.0, 20.0); // 5 MB
long bytePosition = 0;
for (int i = 1; bytePosition < size; i++)
{
// Step 5. Save copy response.
CopyPartRequest copyRequest = new CopyPartRequest()
.withDestinationBucketName(targetBucket.getName())
.withDestinationKey(targetBucket.getPath() + SEPARATOR + fileName)
.withSourceBucketName(srcBucket.getName())
.withSourceKey(srcBucket.getPath() + SEPARATOR + fileName)
.withUploadId(initResult.getUploadId())
.withFirstByte(bytePosition)
.withLastByte(bytePosition + partSize -1 >= size ? size - 1 : bytePosition + partSize - 1)
.withPartNumber(i);
copyResponses.add(s3Client.copyPart(copyRequest));
bytePosition += partSize;
}
CompleteMultipartUploadRequest completeRequest = new
CompleteMultipartUploadRequest(
targetBucket.getName(),
targetBucket.getPath() + SEPARATOR + fileName,
initResult.getUploadId(),
GetETags(copyResponses));
// Step 7. Complete copy operation.
CompleteMultipartUploadResult completeUploadResponse =
s3Client.completeMultipartUpload(completeRequest);
return completeUploadResponse;
}
开发者ID:blacklabelops,项目名称:backuprotator,代码行数:44,代码来源:AWSHandler.java
示例11: copyPart
import com.amazonaws.services.s3.model.CopyPartRequest; //导入依赖的package包/类
@Override
public CopyPartResult copyPart(CopyPartRequest copyPartRequest)
throws AmazonClientException
{
return null;
}
开发者ID:y-lan,项目名称:presto,代码行数:7,代码来源:MockAmazonS3.java
示例12: testMultipartCopy
import com.amazonaws.services.s3.model.CopyPartRequest; //导入依赖的package包/类
@Test
public void testMultipartCopy() throws Exception {
// B2 requires two parts to issue an MPU
assumeTrue(!blobStoreType.equals("b2"));
String sourceBlobName = "testMultipartCopy-source";
String targetBlobName = "testMultipartCopy-target";
ObjectMetadata metadata = new ObjectMetadata();
metadata.setContentLength(BYTE_SOURCE.size());
client.putObject(containerName, sourceBlobName,
BYTE_SOURCE.openStream(), metadata);
InitiateMultipartUploadRequest initiateRequest =
new InitiateMultipartUploadRequest(containerName,
targetBlobName);
InitiateMultipartUploadResult initResult =
client.initiateMultipartUpload(initiateRequest);
String uploadId = initResult.getUploadId();
CopyPartRequest copyRequest = new CopyPartRequest()
.withDestinationBucketName(containerName)
.withDestinationKey(targetBlobName)
.withSourceBucketName(containerName)
.withSourceKey(sourceBlobName)
.withUploadId(uploadId)
.withFirstByte(0L)
.withLastByte(BYTE_SOURCE.size() - 1)
.withPartNumber(1);
CopyPartResult copyPartResult = client.copyPart(copyRequest);
CompleteMultipartUploadRequest completeRequest =
new CompleteMultipartUploadRequest(
containerName, targetBlobName, uploadId,
ImmutableList.of(copyPartResult.getPartETag()));
CompleteMultipartUploadResult completeUploadResponse =
client.completeMultipartUpload(completeRequest);
S3Object object = client.getObject(containerName, targetBlobName);
assertThat(object.getObjectMetadata().getContentLength()).isEqualTo(
BYTE_SOURCE.size());
try (InputStream actual = object.getObjectContent();
InputStream expected = BYTE_SOURCE.openStream()) {
assertThat(actual).hasContentEqualTo(expected);
}
}
开发者ID:gaul,项目名称:s3proxy,代码行数:47,代码来源:AwsSdkTest.java
示例13: copyPart
import com.amazonaws.services.s3.model.CopyPartRequest; //导入依赖的package包/类
@Override
public CopyPartResult copyPart(CopyPartRequest copyPartRequest) throws AmazonClientException, AmazonServiceException {
// TODO Auto-generated method stub
return null;
}
开发者ID:DemandCube,项目名称:Scribengin,代码行数:6,代码来源:AmazonS3Mock.java
示例14: copyPart
import com.amazonaws.services.s3.model.CopyPartRequest; //导入依赖的package包/类
public abstract CopyPartResult copyPart(CopyPartRequest req);
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:2,代码来源:S3Direct.java
示例15: copyPartSecurely
import com.amazonaws.services.s3.model.CopyPartRequest; //导入依赖的package包/类
public abstract CopyPartResult copyPartSecurely(CopyPartRequest req);
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:2,代码来源:S3CryptoModule.java
示例16: copyPart
import com.amazonaws.services.s3.model.CopyPartRequest; //导入依赖的package包/类
public CopyPartResult copyPart(CopyPartRequest req);
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:2,代码来源:S3DirectSpi.java
注:本文中的com.amazonaws.services.s3.model.CopyPartRequest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论