use of com.aliyun.oss.internal.ResponseParsers.UploadPartCopyResponseParser in project aliyun-oss-java-sdk by aliyun.
the class OSSMultipartOperation method uploadPartCopy.
/**
* Upload part copy.
*/
public UploadPartCopyResult uploadPartCopy(UploadPartCopyRequest uploadPartCopyRequest) throws OSSException, ClientException {
assertParameterNotNull(uploadPartCopyRequest, "uploadPartCopyRequest");
String key = uploadPartCopyRequest.getKey();
String bucketName = uploadPartCopyRequest.getBucketName();
String uploadId = uploadPartCopyRequest.getUploadId();
assertParameterNotNull(bucketName, "bucketName");
ensureBucketNameValid(bucketName);
assertParameterNotNull(key, "key");
ensureObjectKeyValid(key);
assertStringNotNullOrEmpty(uploadId, "uploadId");
Long partSize = uploadPartCopyRequest.getPartSize();
if (partSize != null) {
if (!checkParamRange(partSize, 0, true, DEFAULT_FILE_SIZE_LIMIT, true)) {
throw new IllegalArgumentException(OSS_RESOURCE_MANAGER.getString("FileSizeOutOfRange"));
}
}
int partNumber = uploadPartCopyRequest.getPartNumber();
if (!checkParamRange(partNumber, 0, false, MAX_PART_NUMBER, true)) {
throw new IllegalArgumentException(OSS_RESOURCE_MANAGER.getString("PartNumberOutOfRange"));
}
Map<String, String> headers = new HashMap<String, String>();
populateCopyPartRequestHeaders(uploadPartCopyRequest, headers);
// Use a LinkedHashMap to preserve the insertion order.
Map<String, String> params = new LinkedHashMap<String, String>();
params.put(PART_NUMBER, Integer.toString(partNumber));
params.put(UPLOAD_ID, uploadId);
RequestMessage request = new OSSRequestMessageBuilder(getInnerClient()).setEndpoint(getEndpoint()).setMethod(HttpMethod.PUT).setBucket(bucketName).setKey(key).setParameters(params).setHeaders(headers).setOriginalRequest(uploadPartCopyRequest).build();
return doOperation(request, new UploadPartCopyResponseParser(partNumber), bucketName, key, true);
}
Aggregations