首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
社区首页 >问答首页 >AWS文件传输错误

AWS文件传输错误
EN

Stack Overflow用户
提问于 2018-05-08 19:39:05
回答 1查看 118关注 0票数 0
代码语言:javascript
代码运行次数:0
运行
复制
 /**
     * This state represents a transfer that has been queued, but has not yet
     * started
     */
    WAITING,
    /**
     * This state represents a transfer that is currently uploading or
     * downloading data
     */
    IN_PROGRESS,
    /**
     * This state represents a transfer that is paused
     */
    PAUSED,
    /**
     * This state represents a transfer that has been resumed and queued for
     * execution, but has not started to actively transfer data
     */
    RESUMED_WAITING,
    /**
     * This state represents a transfer that is completed
     */
    COMPLETED,
    /**
     * This state represents a transfer that is canceled
     */
    CANCELED,
    /**
     * This state represents a transfer that has failed
     */
    FAILED,

    /**
     * This state represents a transfer that is currently on hold, waiting for
     * the network to become available
     */
    WAITING_FOR_NETWORK,
    /**
     * This state represents a transfer that is a completed part of a multi-part
     * upload. This state is primarily used internally and there should be no
     * need to use this state.
     */
    PART_COMPLETED,
    /**
     * This state represents a transfer that has been requested to cancel, but
     * the service processing transfers has not yet fulfilled this request. This
     * state is primarily used internally and there should be no need to use
     * this state.
     */
    PENDING_CANCEL,
    /**
     * This state represents a transfer that has been requested to pause by the
     * client, but the service processing transfers has not yet fulfilled this
     * request. This state is primarily used internally and there should be no
     * need to use this state.
     */
    PENDING_PAUSE,
    /**
     * This state represents a transfer that has been requested to pause by the
     * client because the network has been loss, but the service processing
     * transfers has not yet fulfilled this request. This state is primarily
     * used internally and there should be no need to use this state.
     */
    PENDING_NETWORK_DISCONNECT,
    /**
     * This is an internal value used to detect if the current transfer is in an
     * unknown state
     */
    UNKNOWN;

我使用下面的代码从互联网上下载一个文件。

代码语言:javascript
代码运行次数:0
运行
复制
TransferObserver observer   =   transferUtil.download(Bucketname, key, file);

        observer.setTransferListener(new TransferListener() {
            @Override
            public void onStateChanged(int i, TransferState transferState) {
                Log.d("AWS download state", transferState.toString());
                if (transferState == TransferState.COMPLETED) {
                }else if(transferState == TransferState.CANCELED){



                }else if(transferState == TransferState.FAILED){


                }else if((transferState == TransferState.WAITING) || (transferState == TransferState.WAITING_FOR_NETWORK)){

                }
            }

            @Override
            public void onProgressChanged(int i, long l, long l1) {


            }

            @Override
            public void onError(int i, Exception e) {
                Log.e("aws error", e.toString());

            }
        });

这些代码中的哪一个表示在互联网上下载失败?可能还有其他错误,如:-

服务器无法提供所请求的文件等。如何区分这些文件?

EN

回答 1

Stack Overflow用户

发布于 2018-05-13 14:52:58

TransferState.FAILED表示传输失败时的状态。当传输达到此状态时,传输将不再继续,并且处于终止状态。

您可以检查TransferState.FAILED并决定是否要重新启动传输或将异常报告回客户。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50232693

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档