在android环境下,如何获取AWS复制操作中的复制操作进度?
我尝试将一个文件从一个文件夹复制到同一个bucket中的另一个文件夹。为了复制文件,我使用CopyObjectRequest类。但我不知道如何获得复制操作的进度? 因此,请帮助我,我如何才能获得复制操作的进度状态 对于复制操作,我遵循以下方法-在android环境下,如何获取AWS复制操作中的复制操作进度?,android,amazon-web-services,amazon-s3,aws-lambda,Android,Amazon Web Services,Amazon S3,Aws Lambda,我尝试将一个文件从一个文件夹复制到同一个bucket中的另一个文件夹。为了复制文件,我使用CopyObjectRequest类。但我不知道如何获得复制操作的进度? 因此,请帮助我,我如何才能获得复制操作的进度状态 对于复制操作,我遵循以下方法- try { AmazonS3 s3Client =new AmazonS3Client(credentials,cc); // Copy the object into a new object in the same
try {
AmazonS3 s3Client =new AmazonS3Client(credentials,cc);
// Copy the object into a new object in the same bucket.
CopyObjectRequest copyObjRequest = new CopyObjectRequest(bucketName, sourceKey, "wedorias-new", "test/test111/logo.png"/*destinationKey*/);
s3Client.copyObject(copyObjRequest);
if (copyObjRequest.isRequesterPays()){
System.out.println("sadfbgnh==");
}
} catch (AmazonServiceException e) {
// The call was transmitted successfully, but Amazon S3 couldn't process
// it, so it returned an error response.
e.printStackTrace();
System.out.println("exception==!"+e.getErrorMessage());
System.out.println("exception==!"+e.getErrorCode());
System.out.println("exception==!"+e.getMessage());
} catch (Exception e) {
e.printStackTrace();
System.out.println("exception==!"+e.getMessage());
}
如果要将一个对象从一个文件夹复制到另一个文件夹(如果是这样的话,也可以复制到其他bucket)并检查进度,则必须使用 AWS文档有一个很好的示例,名为,它向您展示了如何进行设置和检查副本的进度
// Get the object size to track the end of the copy operation.
GetObjectMetadataRequest metadataRequest = new GetObjectMetadataRequest(sourceBucketName, sourceObjectKey);
ObjectMetadata metadataResult = s3Client.getObjectMetadata(metadataRequest);
long objectSize = metadataResult.getContentLength();
通知
- 当对象大于5GB时,必须进行多部分上载
- 当对象大于100MB时,建议使用多部分上载
- 如果对象小于5MB,则多部分上载不起作用