新浪彩票 v0.96.37版本的 MD5 值为:0c7ddce345383506e2959f5d75bdceab

以下内容为反编译后的 FormUploader.java 源代码,内容仅作参考


package cn.bmob.v3.datatype.up;

import cn.bmob.v3.exception.BmobException;
import com.huawei.hms.framework.common.ContainerUtils;
import java.io.File;
import java.io.IOException;
import java.util.Map;
public class FormUploader implements Runnable {
    private String apiKey;
    private String bucket;
    private UploadClient client;
    private UpCompleteListener completeListener;
    private File file;
    private Map<String, Object> params;
    private String policy;
    private UpProgressListener progressListener;
    private int retryTime;
    private String signature;
    private SignatureListener signatureListener;

    public FormUploader(UploadClient uploadClient, File file, Map<String, Object> map, String str, SignatureListener signatureListener, UpCompleteListener upCompleteListener, UpProgressListener upProgressListener) {
        this.client = uploadClient;
        this.file = file;
        this.bucket = (String) map.get(Params.BUCKET);
        this.params = map;
        this.apiKey = str;
        this.signatureListener = signatureListener;
        this.completeListener = upCompleteListener;
        this.progressListener = upProgressListener;
    }

    @Override
    public void run() {
        String str = (String) this.params.get(Params.SAVE_KEY);
        String str2 = (String) this.params.remove("path");
        if (str == null && str2 != null) {
            this.params.put(Params.SAVE_KEY, str2);
        }
        String policy = UpYunUtils.getPolicy(this.params);
        this.policy = policy;
        String str3 = this.apiKey;
        if (str3 != null) {
            this.signature = UpYunUtils.getSignature(policy, str3);
        } else {
            SignatureListener signatureListener = this.signatureListener;
            if (signatureListener != null) {
                this.signature = signatureListener.getSignature(this.policy + ContainerUtils.FIELD_DELIMITER);
            } else {
                throw new RuntimeException("apiKey 和 signatureListener 不能同时为null");
            }
        }
        boolean z = true;
        try {
            this.completeListener.onComplete(true, this.client.fromUpLoad(this.file, "http://v0.api.upyun.com/" + this.bucket, this.policy, this.signature, this.progressListener));
        } catch (BmobException | IOException e) {
            int i = this.retryTime + 1;
            this.retryTime = i;
            boolean z2 = i > 2;
            z = (!(e instanceof BmobException) || ((BmobException) e).getErrorCode() / 100 == 5) ? false : false;
            if (!z2 && !z) {
                run();
            } else {
                this.completeListener.onComplete(false, e.toString());
            }
        }
    }
}