當前位置: 首頁>>代碼示例>>Java>>正文


Java StringMap類代碼示例

本文整理匯總了Java中com.qiniu.android.utils.StringMap的典型用法代碼示例。如果您正苦於以下問題:Java StringMap類的具體用法?Java StringMap怎麽用?Java StringMap使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


StringMap類屬於com.qiniu.android.utils包,在下文中一共展示了StringMap類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: asyncMultipartPost

import com.qiniu.android.utils.StringMap; //導入依賴的package包/類
private void asyncMultipartPost(String url, StringMap fields, ProgressHandler
        progressHandler, String fileName, RequestBody file, CompletionHandler
        completionHandler, CancellationHandler cancellationHandler) {
    if (this.converter != null) {
        url = this.converter.convert(url);
    }
    final MultipartBuilder mb = new MultipartBuilder();
    mb.addFormDataPart("file", fileName, file);
    fields.forEach(new Consumer() {
        public void accept(String key, Object value) {
            mb.addFormDataPart(key, value.toString());
        }
    });
    mb.type(MediaType.parse("multipart/form-data"));
    RequestBody body = mb.build();
    if (progressHandler != null) {
        body = new CountingRequestBody(body, progressHandler, cancellationHandler);
    }
    asyncSend(new Builder().url(url).post(body), null, completionHandler);
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:21,代碼來源:Client.java

示例2: copyPolicy

import com.qiniu.android.utils.StringMap; //導入依賴的package包/類
private static void copyPolicy(final StringMap policy, StringMap originPolicy, final boolean strict) {
    if (originPolicy == null) {
        return;
    }
    originPolicy.forEach(new StringMap.Consumer() {
        @Override
        public void accept(String key, Object value) {
            if (StringUtils.inStringArray(key, deprecatedPolicyFields)) {
                throw new IllegalArgumentException(key + " is deprecated!");
            }
            if (!strict || StringUtils.inStringArray(key, policyFields)) {
                policy.put(key, value);
            }
        }
    });
}
 
開發者ID:lqxue,項目名稱:QiNiuTest,代碼行數:17,代碼來源:Auth.java

示例3: decode

import com.qiniu.android.utils.StringMap; //導入依賴的package包/類
public static StringMap decode(String json) {
    // CHECKSTYLE:OFF
    Type t = new TypeToken<Map<String, Object>>() {
    }.getType();
    // CHECKSTYLE:ON
    Map<String, Object> x = new Gson().fromJson(json, t);
    return new StringMap(x);
}
 
開發者ID:lqxue,項目名稱:QiNiuTest,代碼行數:9,代碼來源:Json.java

示例4: uploadTokenWithDeadline

import com.qiniu.android.utils.StringMap; //導入依賴的package包/類
String uploadTokenWithDeadline(String bucket, String key, long deadline, StringMap policy, boolean strict) {
    String scope = bucket;
    if (key != null) {
        scope = bucket + ":" + key;
    }
    StringMap x = new StringMap();
    copyPolicy(x, policy, strict);
    x.put("scope", scope);
    x.put("deadline", deadline);

    String s = Json.encode(x);
    return signWithData(StringUtils.utf8Bytes(s));
}
 
開發者ID:lqxue,項目名稱:QiNiuTest,代碼行數:14,代碼來源:Auth.java

示例5: asyncPost

import com.qiniu.android.utils.StringMap; //導入依賴的package包/類
public void asyncPost(String url, byte[] body, int offset, int size, StringMap headers,
                      ProgressHandler progressHandler, CompletionHandler completionHandler,
                      CancellationHandler c) {
    RequestBody rbody;
    RequestBody rbody2;
    if (this.converter != null) {
        url = this.converter.convert(url);
    }
    if (body == null || body.length <= 0) {
        rbody = RequestBody.create(null, new byte[0]);
    } else {
        rbody = RequestBody.create(MediaType.parse("application/octet-stream"), body, offset,
                size);
    }
    if (progressHandler != null) {
        rbody2 = new CountingRequestBody(rbody, progressHandler, c);
    } else {
        rbody2 = rbody;
    }
    asyncSend(new Builder().url(url).post(rbody2), headers, completionHandler);
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:22,代碼來源:Client.java

示例6: ResumeUploader

import com.qiniu.android.utils.StringMap; //導入依賴的package包/類
ResumeUploader(Client client, Configuration config, File f, String key, UpToken token, final
UpCompletionHandler completionHandler, UploadOptions options, String recorderKey) {
    this.client = client;
    this.config = config;
    this.f = f;
    this.recorderKey = recorderKey;
    this.size = (int) f.length();
    this.key = key;
    this.headers = new StringMap().put("Authorization", "UpToken " + token.token);
    this.completionHandler = new UpCompletionHandler() {
        public void complete(String key, ResponseInfo info, JSONObject response) {
            if (ResumeUploader.this.file != null) {
                try {
                    ResumeUploader.this.file.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            completionHandler.complete(key, info, response);
        }
    };
    if (options == null) {
        options = UploadOptions.defaultOptions();
    }
    this.options = options;
    this.chunkBuffer = new byte[config.chunkSize];
    this.contexts = new String[((int) ((long) (((this.size + Configuration.BLOCK_SIZE) - 1) /
            Configuration.BLOCK_SIZE)))];
    this.modifyTime = f.lastModified();
    this.token = token;
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:32,代碼來源:ResumeUploader.java

示例7: uploadTokenWithDeadline

import com.qiniu.android.utils.StringMap; //導入依賴的package包/類
String uploadTokenWithDeadline(String bucket, String key, long deadline, StringMap policy, boolean strict) {
    String scope = bucket;
    if (key != null) {
        scope = bucket + ":" + key;
    }
    StringMap x = new StringMap();
    copyPolicy(x, policy, strict);
    x.put("scope", scope);
    x.put("deadline", deadline);

    String s = new Gson().toJson(x.map());
    return signWithData(StringUtils.utf8Bytes(s));
}
 
開發者ID:luania,項目名稱:witchpot,代碼行數:14,代碼來源:Auth.java

示例8: encode

import com.qiniu.android.utils.StringMap; //導入依賴的package包/類
public static String encode(StringMap map) {
    return new Gson().toJson(map.map());
}
 
開發者ID:lqxue,項目名稱:QiNiuTest,代碼行數:4,代碼來源:Json.java

示例9: authorization

import com.qiniu.android.utils.StringMap; //導入依賴的package包/類
public StringMap authorization(String url) {
    return authorization(url, null, null);
}
 
開發者ID:lqxue,項目名稱:QiNiuTest,代碼行數:4,代碼來源:Auth.java

示例10: uploadToken

import com.qiniu.android.utils.StringMap; //導入依賴的package包/類
/**
 * 生成上傳token
 *
 * @param bucket  空間名
 * @param key     key,可為 null
 * @param expires 有效時長,單位秒
 * @param policy  上傳策略的其它參數,如 new StringMap().put("endUser", "uid").putNotEmpty("returnBody", "")。
 *                scope通過 bucket、key間接設置,deadline 通過 expires 間接設置
 * @return 生成的上傳token
 */
public String uploadToken(String bucket, String key, long expires, StringMap policy) {
    return uploadToken(bucket, key, expires, policy, true);
}
 
開發者ID:lqxue,項目名稱:QiNiuTest,代碼行數:14,代碼來源:Auth.java


注:本文中的com.qiniu.android.utils.StringMap類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。