Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在android环境下,如何获取AWS复制操作中的复制操作进度?_Android_Amazon Web Services_Amazon S3_Aws Lambda - Fatal编程技术网

在android环境下,如何获取AWS复制操作中的复制操作进度?

在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

我尝试将一个文件从一个文件夹复制到同一个bucket中的另一个文件夹。为了复制文件,我使用CopyObjectRequest类。但我不知道如何获得复制操作的进度? 因此,请帮助我,我如何才能获得复制操作的进度状态

对于复制操作,我遵循以下方法-

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,则多部分上载不起作用


谢谢您的回答。我可以知道我怎样才能得到同样的删除操作吗?我很高兴我的回答帮助了你。我还没有试过,我认为这是不可能的,但你可以随时提出一个新问题,看看是否有人能告诉你这是否可能,并给出一个很好的解释。