鳯华 v4.0.0版本的 MD5 值为:e66eea5d0a772ef117f7e252dfbb1dfc
以下内容为反编译后的 BucketManager.java 源代码,内容仅作参考
package com.qiniu.storage;
import com.faceunity.utils.MakeupParamHelper;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonNull;
import com.google.gson.JsonObject;
import com.qiniu.common.Constants;
import com.qiniu.common.QiniuException;
import com.qiniu.http.Client;
import com.qiniu.http.Response;
import com.qiniu.storage.model.AccessStyleMode;
import com.qiniu.storage.model.AclType;
import com.qiniu.storage.model.BucketEventRule;
import com.qiniu.storage.model.BucketInfo;
import com.qiniu.storage.model.BucketLifeCycleRule;
import com.qiniu.storage.model.BucketQuota;
import com.qiniu.storage.model.BucketReferAntiLeech;
import com.qiniu.storage.model.CorsRule;
import com.qiniu.storage.model.FetchRet;
import com.qiniu.storage.model.FileInfo;
import com.qiniu.storage.model.FileListing;
import com.qiniu.storage.model.IndexPageType;
import com.qiniu.storage.model.StorageType;
import com.qiniu.util.Auth;
import com.qiniu.util.Json;
import com.qiniu.util.StringMap;
import com.qiniu.util.StringUtils;
import com.qiniu.util.UrlSafeBase64;
import com.tencent.open.SocialConstants;
import com.tencent.qcloud.tim.uikit.utils.TUIKitConstants;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
public final class BucketManager {
private final Auth auth;
private final Client client;
private ConfigHelper configHelper;
public static class BatchOperations {
private String execBucket = null;
private ArrayList<String> ops = new ArrayList<>();
private void setExecBucket(String str) {
if (this.execBucket == null) {
this.execBucket = str;
}
}
public BatchOperations addChangeStatusOps(String str, int i9, String... strArr) {
for (String str2 : strArr) {
this.ops.add(String.format("chstatus/%s/status/%d", BucketManager.encodedEntry(str, str2), Integer.valueOf(i9)));
}
setExecBucket(str);
return this;
}
public BatchOperations addChangeTypeOps(String str, StorageType storageType, String... strArr) {
for (String str2 : strArr) {
this.ops.add(String.format("chtype/%s/type/%d", BucketManager.encodedEntry(str, str2), Integer.valueOf(storageType.ordinal())));
}
setExecBucket(str);
return this;
}
public BatchOperations addChgmOp(String str, String str2, String str3) {
this.ops.add(String.format("/chgm/%s/mime/%s", BucketManager.encodedEntry(str, str2), UrlSafeBase64.encodeToString(str3)));
setExecBucket(str);
return this;
}
public BatchOperations addCopyOp(String str, String str2, String str3, String str4) {
this.ops.add(String.format("copy/%s/%s", BucketManager.encodedEntry(str, str2), BucketManager.encodedEntry(str3, str4)));
setExecBucket(str);
return this;
}
public BatchOperations addDeleteAfterDaysOps(String str, int i9, String... strArr) {
for (String str2 : strArr) {
this.ops.add(String.format("deleteAfterDays/%s/%d", BucketManager.encodedEntry(str, str2), Integer.valueOf(i9)));
}
setExecBucket(str);
return this;
}
public BatchOperations addDeleteOp(String str, String... strArr) {
for (String str2 : strArr) {
this.ops.add(String.format("delete/%s", BucketManager.encodedEntry(str, str2)));
}
setExecBucket(str);
return this;
}
public BatchOperations addMoveOp(String str, String str2, String str3, String str4) {
this.ops.add(String.format("move/%s/%s", BucketManager.encodedEntry(str, str2), BucketManager.encodedEntry(str3, str4)));
setExecBucket(str);
return this;
}
public BatchOperations addRenameOp(String str, String str2, String str3) {
return addMoveOp(str, str2, str, str3);
}
public BatchOperations addStatOps(String str, String... strArr) {
for (String str2 : strArr) {
this.ops.add(String.format("stat/%s", BucketManager.encodedEntry(str, str2)));
}
setExecBucket(str);
return this;
}
public BatchOperations clearOps() {
this.ops.clear();
return this;
}
public String execBucket() {
return this.execBucket;
}
public BatchOperations merge(BatchOperations batchOperations) {
this.ops.addAll(batchOperations.ops);
setExecBucket(batchOperations.execBucket());
return this;
}
public byte[] toBody() {
return StringUtils.utf8Bytes(StringUtils.join(this.ops, "&op=", "op="));
}
}
public class FileListIterator implements Iterator<FileInfo[]> {
private String bucket;
private String delimiter;
private int limit;
private String prefix;
private String marker = null;
private QiniuException exception = null;
public FileListIterator(String str, String str2, int i9, String str3) {
if (i9 <= 0) {
throw new IllegalArgumentException("limit must greater than 0");
}
if (i9 <= 1000) {
this.bucket = str;
this.prefix = str2;
this.limit = i9;
this.delimiter = str3;
return;
}
throw new IllegalArgumentException("limit must not greater than 1000");
}
public QiniuException error() {
return this.exception;
}
@Override
public boolean hasNext() {
return this.exception == null && !"".equals(this.marker);
}
@Override
public void remove() {
throw new UnsupportedOperationException("remove");
}
@Override
public FileInfo[] next() {
try {
FileListing listFiles = BucketManager.this.listFiles(this.bucket, this.prefix, this.marker, this.limit, this.delimiter);
String str = listFiles.marker;
if (str == null) {
str = "";
}
this.marker = str;
return listFiles.items;
} catch (QiniuException e9) {
this.exception = e9;
return null;
}
}
}
public BucketManager(Auth auth, Configuration configuration) {
this.auth = auth;
Configuration configuration2 = configuration == null ? new Configuration() : configuration.m13clone();
this.configHelper = new ConfigHelper(configuration2);
this.client = new Client(configuration2);
}
private void check(String str) throws QiniuException {
if (StringUtils.isNullOrEmpty(str)) {
throw new QiniuException(Response.createError(null, null, MakeupParamHelper.MakeupParams.BROW_WARP_TYPE_WILLOW, "未指定操作的空间或操作体为空"));
}
}
public static String encodedEntry(String str, String str2) {
if (str2 != null) {
return UrlSafeBase64.encodeToString(str + ":" + str2);
}
return UrlSafeBase64.encodeToString(str);
}
private Response get(String str) throws QiniuException {
return this.client.get(str, this.auth.authorization(str));
}
private Response ioPost(String str, String str2) throws QiniuException {
check(str);
return post(this.configHelper.ioHost(this.auth.accessKey, str) + str2, null);
}
private String listQuery(String str, String str2, String str3, int i9, String str4) {
return new StringMap().put("bucket", str).putNotEmpty("marker", str3).putNotEmpty("prefix", str2).putNotEmpty("delimiter", str4).putWhen(TUIKitConstants.Selection.LIMIT, Integer.valueOf(i9), i9 > 0).formString();
}
private Response post(String str, byte[] bArr) throws QiniuException {
return this.client.post(str, bArr, this.auth.authorization(str, bArr, "application/x-www-form-urlencoded"), "application/x-www-form-urlencoded");
}
private Response pubPost(String str) throws QiniuException {
return post("http://pu.qbox.me:10200" + str, null);
}
private Response rsGet(String str, String str2) throws QiniuException {
check(str);
return get(this.configHelper.rsHost(this.auth.accessKey, str) + str2);
}
private Response rsPost(String str, String str2, byte[] bArr) throws QiniuException {
check(str);
return post(this.configHelper.rsHost(this.auth.accessKey, str) + str2, bArr);
}
public Response asynFetch(String str, String str2, String str3) throws QiniuException {
return asyncFetch(str, str2, new StringMap().putNotNull("key", str3));
}
public Response asyncFetch(String str, String str2, StringMap stringMap) throws QiniuException {
if (stringMap == null) {
stringMap = new StringMap();
}
stringMap.put(SocialConstants.PARAM_URL, str).put("bucket", str2);
String str3 = this.configHelper.apiHost(this.auth.accessKey, str2) + "/sisyphus/fetch";
byte[] bytes = Json.encode(stringMap).getBytes(Constants.UTF_8);
return this.client.post(str3, bytes, this.auth.authorizationV2(str3, "POST", bytes, "application/json"), "application/json");
}
public Response batch(BatchOperations batchOperations) throws QiniuException {
return rsPost(batchOperations.execBucket(), "/batch", batchOperations.toBody());
}
public String[] buckets() throws QiniuException {
Response bucketsResponse = bucketsResponse();
String[] strArr = (String[]) bucketsResponse.jsonToObject(String[].class);
bucketsResponse.close();
return strArr;
}
public Response bucketsResponse() throws QiniuException {
Response response = get(String.format("%s/buckets", this.configHelper.rsHost()));
if (response.isOK()) {
return response;
}
throw new QiniuException(response);
}
public Response changeHeaders(String str, String str2, Map<String, String> map) throws QiniuException {
String format = String.format("/chgm/%s", encodedEntry(str, str2));
for (String str3 : map.keySet()) {
format = String.format("%s/x-qn-meta-!%s/%s", format, str3, UrlSafeBase64.encodeToString(map.get(str3)));
}
return rsPost(str, format, null);
}
public Response changeMime(String str, String str2, String str3) throws QiniuException {
return rsPost(str, String.format("/chgm/%s/mime/%s", encodedEntry(str, str2), UrlSafeBase64.encodeToString(str3)), null);
}
public Response changeStatus(String str, String str2, int i9) throws QiniuException {
return rsPost(str, String.format("/chstatus/%s/status/%d", encodedEntry(str, str2), Integer.valueOf(i9)), null);
}
public Response changeType(String str, String str2, StorageType storageType) throws QiniuException {
return rsPost(str, String.format("/chtype/%s/type/%d", encodedEntry(str, str2), Integer.valueOf(storageType.ordinal())), null);
}
public Response checkAsynFetchid(String str, String str2) throws QiniuException {
String format = String.format("http://api-%s.qiniu.com/sisyphus/fetch?id=%s", str, str2);
return this.client.get(format, this.auth.authorization(format));
}
public Response copy(String str, String str2, String str3, String str4, boolean z9) throws QiniuException {
return rsPost(str, String.format("/copy/%s/%s/force/%s", encodedEntry(str, str2), encodedEntry(str3, str4), Boolean.valueOf(z9)), null);
}
public Response createBucket(String str, String str2) throws QiniuException {
Response post = post(String.format("%s/mkbucketv3/%s/region/%s", this.configHelper.rsHost(), str, str2), null);
if (post.isOK()) {
return post;
}
throw new QiniuException(post);
}
public FileListIterator createFileListIterator(String str, String str2) {
return new FileListIterator(str, str2, 1000, null);
}
public Response delete(String str, String str2) throws QiniuException {
return rsPost(str, String.format("/delete/%s", encodedEntry(str, str2)), null);
}
public Response deleteAfterDays(String str, String str2, int i9) throws QiniuException {
return rsPost(str, String.format("/deleteAfterDays/%s/%d", encodedEntry(str, str2), Integer.valueOf(i9)), null);
}
public Response deleteBucketEvent(String str, String str2) throws QiniuException {
Response post = post(String.format("%s/events/delete?bucket=%s&name=%s", this.configHelper.ucHost(), str, str2), null);
if (post.isOK()) {
return post;
}
throw new QiniuException(post);
}
public Response deleteBucketLifecycleRule(String str, String str2) throws QiniuException {
Response post = post(String.format("%s/rules/delete?bucket=%s&name=%s", this.configHelper.ucHost(), str, str2), null);
if (post.isOK()) {
return post;
}
throw new QiniuException(post);
}
public String[] domainList(String str) throws QiniuException {
Response domainListResponse = domainListResponse(str);
String[] strArr = (String[]) domainListResponse.jsonToObject(String[].class);
domainListResponse.close();
return strArr;
}
public Response domainListResponse(String str) throws QiniuException {
Response response = get(String.format("%s/v6/domain/list?tbl=%s", this.configHelper.apiHost(), str));
if (response.isOK()) {
return response;
}
throw new QiniuException(response);
}
public FetchRet fetch(String str, String str2) throws QiniuException {
return fetch(str, str2, null);
}
public Response fetchResponse(String str, String str2, String str3) throws QiniuException {
Response ioPost = ioPost(str2, String.format("/fetch/%s/to/%s", UrlSafeBase64.encodeToString(str), encodedEntry(str2, str3)));
if (ioPost.isOK()) {
return ioPost;
}
throw new QiniuException(ioPost);
}
public BucketEventRule[] getBucketEvents(String str) throws QiniuException {
BucketEventRule[] bucketEventRuleArr;
Response bucketEventsResponse = getBucketEventsResponse(str);
JsonElement jsonElement = (JsonElement) Json.decode(bucketEventsResponse.bodyString(), JsonElement.class);
if (jsonElement instanceof JsonNull) {
bucketEventRuleArr = new BucketEventRule[0];
} else {
JsonArray jsonArray = (JsonArray) jsonElement;
BucketEventRule[] bucketEventRuleArr2 = new BucketEventRule[jsonArray.size()];
for (int i9 = 0; i9 < jsonArray.size(); i9++) {
bucketEventRuleArr2[i9] = (BucketEventRule) Json.decode(jsonArray.get(i9), BucketEventRule.class);
}
bucketEventRuleArr = bucketEventRuleArr2;
}
bucketEventsResponse.close();
return bucketEventRuleArr;
}
public Response getBucketEventsResponse(String str) throws QiniuException {
Response post = post(String.format("%s/events/get?bucket=%s", this.configHelper.ucHost(), str), null);
if (post.isOK()) {
return post;
}
throw new QiniuException(post);
}
public BucketInfo getBucketInfo(String str) throws QiniuException {
Response bucketInfoResponse = getBucketInfoResponse(str);
BucketInfo bucketInfo = (BucketInfo) bucketInfoResponse.jsonToObject(BucketInfo.class);
bucketInfoResponse.close();
return bucketInfo;
}
public Response getBucketInfoResponse(String str) throws QiniuException {
Response post = post(String.format("%s/v2/bucketInfo?bucket=%s", this.configHelper.ucHost(), str), null);
if (post.isOK()) {
post.close();
return post;
}
throw new QiniuException(post);
}
public BucketLifeCycleRule[] getBucketLifeCycleRule(String str) throws QiniuException {
BucketLifeCycleRule[] bucketLifeCycleRuleArr;
Response bucketLifeCycleRuleResponse = getBucketLifeCycleRuleResponse(str);
JsonElement jsonElement = (JsonElement) Json.decode(bucketLifeCycleRuleResponse.bodyString(), JsonElement.class);
if (jsonElement instanceof JsonNull) {
bucketLifeCycleRuleArr = new BucketLifeCycleRule[0];
} else {
JsonArray jsonArray = (JsonArray) jsonElement;
BucketLifeCycleRule[] bucketLifeCycleRuleArr2 = new BucketLifeCycleRule[jsonArray.size()];
for (int i9 = 0; i9 < jsonArray.size(); i9++) {
bucketLifeCycleRuleArr2[i9] = (BucketLifeCycleRule) Json.decode(jsonArray.get(i9), BucketLifeCycleRule.class);
}
bucketLifeCycleRuleArr = bucketLifeCycleRuleArr2;
}
bucketLifeCycleRuleResponse.close();
return bucketLifeCycleRuleArr;
}
public Response getBucketLifeCycleRuleResponse(String str) throws QiniuException {
Response post = post(String.format("%s/rules/get?bucket=%s", this.configHelper.ucHost(), str), null);
if (post.isOK()) {
return post;
}
throw new QiniuException(post);
}
public BucketQuota getBucketQuota(String str) throws QiniuException {
Response bucketQuotaResponse = getBucketQuotaResponse(str);
BucketQuota bucketQuota = (BucketQuota) bucketQuotaResponse.jsonToObject(BucketQuota.class);
bucketQuotaResponse.close();
return bucketQuota;
}
public Response getBucketQuotaResponse(String str) throws QiniuException {
Response post = post(String.format("%s/getbucketquota/%s", this.configHelper.apiHost(), str), null);
if (post.isOK()) {
return post;
}
throw new QiniuException(post);
}
public CorsRule[] getCorsRules(String str) throws QiniuException {
CorsRule[] corsRuleArr;
Response corsRulesResponse = getCorsRulesResponse(str);
JsonElement jsonElement = (JsonElement) Json.decode(corsRulesResponse.bodyString(), JsonElement.class);
if (jsonElement instanceof JsonNull) {
corsRuleArr = new CorsRule[0];
} else {
JsonArray jsonArray = (JsonArray) jsonElement;
CorsRule[] corsRuleArr2 = new CorsRule[jsonArray.size()];
for (int i9 = 0; i9 < jsonArray.size(); i9++) {
corsRuleArr2[i9] = (CorsRule) Json.decode(jsonArray.get(i9), CorsRule.class);
}
corsRuleArr = corsRuleArr2;
}
corsRulesResponse.close();
return corsRuleArr;
}
public Response getCorsRulesResponse(String str) throws QiniuException {
Response post = post(String.format("%s/corsRules/get/%s", this.configHelper.ucHost(), str), null);
if (post.isOK()) {
return post;
}
throw new QiniuException(post);
}
public FileListing listFiles(String str, String str2, String str3, int i9, String str4) throws QiniuException {
Response listV1 = listV1(str, str2, str3, i9, str4);
if (listV1.isOK()) {
FileListing fileListing = (FileListing) listV1.jsonToObject(FileListing.class);
listV1.close();
return fileListing;
}
throw new QiniuException(listV1);
}
public FileListing listFilesV2(String str, String str2, String str3, int i9, String str4) throws QiniuException {
Response listV2 = listV2(str, str2, str3, i9, str4);
String bodyString = listV2.bodyString();
listV2.close();
List asList = Arrays.asList(bodyString.split("\n"));
FileListing fileListing = new FileListing();
ArrayList arrayList = new ArrayList();
HashSet hashSet = new HashSet();
for (int i10 = 0; i10 < asList.size(); i10++) {
JsonObject jsonObject = (JsonObject) Json.decode((String) asList.get(i10), JsonObject.class);
if (jsonObject != null) {
if (!(jsonObject.get("item") instanceof JsonNull)) {
arrayList.add(Json.decode(jsonObject.get("item"), FileInfo.class));
}
String asString = jsonObject.get("dir").getAsString();
if (!"".equals(asString)) {
hashSet.add(asString);
}
if (i10 == asList.size() - 1) {
fileListing.marker = jsonObject.get("marker").getAsString();
}
}
}
fileListing.items = (FileInfo[]) arrayList.toArray(new FileInfo[0]);
fileListing.commonPrefixes = (String[]) hashSet.toArray(new String[0]);
return fileListing;
}
public Response listV1(String str, String str2, String str3, int i9, String str4) throws QiniuException {
return get(String.format("%s/list?%s", this.configHelper.rsfHost(this.auth.accessKey, str), listQuery(str, str2, str3, i9, str4)));
}
public Response listV2(String str, String str2, String str3, int i9, String str4) throws QiniuException {
return get(String.format("%s/v2/list?%s", this.configHelper.rsfHost(this.auth.accessKey, str), listQuery(str, str2, str3, i9, str4)));
}
public Response move(String str, String str2, String str3, String str4, boolean z9) throws QiniuException {
return rsPost(str, String.format("/move/%s/%s/force/%s", encodedEntry(str, str2), encodedEntry(str3, str4), Boolean.valueOf(z9)), null);
}
public Response prefetch(String str, String str2) throws QiniuException {
Response ioPost = ioPost(str, String.format("/prefetch/%s", encodedEntry(str, str2)));
if (ioPost.isOK()) {
return ioPost;
}
throw new QiniuException(ioPost);
}
public Response putBucketAccessMode(String str, AclType aclType) throws QiniuException {
Response post = post(String.format("%s/private?bucket=%s&private=%s", this.configHelper.ucHost(), str, Integer.valueOf(aclType.getType())), null);
if (post.isOK()) {
return post;
}
throw new QiniuException(post);
}
public Response putBucketAccessStyleMode(String str, AccessStyleMode accessStyleMode) throws QiniuException {
Response post = post(String.format("%s/accessMode/%s/mode/%d", this.configHelper.ucHost(), str, Integer.valueOf(accessStyleMode.getType())), null);
if (post.isOK()) {
return post;
}
throw new QiniuException(post);
}
public Response putBucketEvent(String str, BucketEventRule bucketEventRule) throws QiniuException {
Response post = post(String.format("%s/events/add?bucket=%s&%s", this.configHelper.ucHost(), str, bucketEventRule.asQueryString()), null);
if (post.isOK()) {
return post;
}
throw new QiniuException(post);
}
public Response putBucketLifecycleRule(String str, BucketLifeCycleRule bucketLifeCycleRule) throws QiniuException {
Response post = post(String.format("%s/rules/add?bucket=%s&%s", this.configHelper.ucHost(), str, bucketLifeCycleRule.asQueryString()), null);
if (post.isOK()) {
return post;
}
throw new QiniuException(post);
}
public Response putBucketMaxAge(String str, long j9) throws QiniuException {
Response post = post(String.format("%s/maxAge?bucket=%s&maxAge=%d", this.configHelper.ucHost(), str, Long.valueOf(j9)), null);
if (post.isOK()) {
return post;
}
throw new QiniuException(post);
}
public Response putBucketQuota(String str, BucketQuota bucketQuota) throws QiniuException {
Response post = post(String.format("%s/setbucketquota/%s/size/%d/count/%d", this.configHelper.apiHost(), str, Long.valueOf(bucketQuota.getSize()), Long.valueOf(bucketQuota.getCount())), null);
if (post.isOK()) {
return post;
}
throw new QiniuException(post);
}
public Response putCorsRules(String str, CorsRule[] corsRuleArr) throws QiniuException {
Response post = post(String.format("%s/corsRules/set/%s", this.configHelper.ucHost(), str), Json.encode(corsRuleArr).getBytes());
if (post.isOK()) {
return post;
}
throw new QiniuException(post);
}
public Response putReferAntiLeech(String str, BucketReferAntiLeech bucketReferAntiLeech) throws QiniuException {
Response post = post(String.format("%s/referAntiLeech?bucket=%s&%s", this.configHelper.ucHost(), str, bucketReferAntiLeech.asQueryString()), null);
if (post.isOK()) {
return post;
}
throw new QiniuException(post);
}
public Response rename(String str, String str2, String str3, boolean z9) throws QiniuException {
return move(str, str2, str, str3, z9);
}
public Response restoreArchive(String str, String str2, int i9) throws QiniuException {
String str3 = this.configHelper.rsHost(this.auth.accessKey, str) + String.format("/restoreAr/%s/freezeAfterDays/%s", encodedEntry(str, str2), Integer.toString(i9));
return this.client.post(str3, null, this.auth.authorizationV2(str3, "POST", null, "application/json"), "application/json");
}
@Deprecated
public Response setBucketAcl(String str, AclType aclType) throws QiniuException {
return putBucketAccessMode(str, aclType);
}
@Deprecated
public Response setImage(String str, String str2) throws QiniuException {
return setImage(str, str2, null);
}
public Response setIndexPage(String str, IndexPageType indexPageType) throws QiniuException {
Response post = post(String.format("%s/noIndexPage?bucket=%s&noIndexPage=%s", this.configHelper.ucHost(), str, Integer.valueOf(indexPageType.getType())), null);
if (post.isOK()) {
return post;
}
throw new QiniuException(post);
}
public FileInfo stat(String str, String str2) throws QiniuException {
Response statResponse = statResponse(str, str2);
FileInfo fileInfo = (FileInfo) statResponse.jsonToObject(FileInfo.class);
statResponse.close();
return fileInfo;
}
public Response statResponse(String str, String str2) throws QiniuException {
Response rsGet = rsGet(str, String.format("/stat/%s", encodedEntry(str, str2)));
if (rsGet.isOK()) {
return rsGet;
}
throw new QiniuException(rsGet);
}
@Deprecated
public Response unsetImage(String str) throws QiniuException {
return pubPost(String.format("/unimage/%s", str));
}
public Response updateBucketEvent(String str, BucketEventRule bucketEventRule) throws QiniuException {
Response post = post(String.format("%s/events/update?bucket=%s&%s", this.configHelper.ucHost(), str, bucketEventRule.asQueryString()), null);
if (post.isOK()) {
return post;
}
throw new QiniuException(post);
}
public Response updateBucketLifeCycleRule(String str, BucketLifeCycleRule bucketLifeCycleRule) throws QiniuException {
Response post = post(String.format("%s/rules/update?bucket=%s&%s", this.configHelper.ucHost(), str, bucketLifeCycleRule.asQueryString()), null);
if (post.isOK()) {
return post;
}
throw new QiniuException(post);
}
public FileListIterator createFileListIterator(String str, String str2, int i9, String str3) {
return new FileListIterator(str, str2, i9, str3);
}
public FetchRet fetch(String str, String str2, String str3) throws QiniuException {
Response fetchResponse = fetchResponse(str, str2, str3);
FetchRet fetchRet = (FetchRet) fetchResponse.jsonToObject(FetchRet.class);
fetchResponse.close();
return fetchRet;
}
public Response rename(String str, String str2, String str3) throws QiniuException {
return move(str, str2, str, str3);
}
@Deprecated
public Response setImage(String str, String str2, String str3) throws QiniuException {
String encodeToString = UrlSafeBase64.encodeToString(str2);
String encodeToString2 = (str3 == null || str3.length() <= 0) ? null : UrlSafeBase64.encodeToString(str3);
String format = String.format("/image/%s/from/%s", str, encodeToString);
if (encodeToString2 != null) {
format = format + String.format("/host/%s", encodeToString2);
}
return pubPost(format);
}
public static String encodedEntry(String str) {
return encodedEntry(str, null);
}
public Response asynFetch(String str, String str2, String str3, String str4, String str5, String str6, String str7, String str8, String str9, int i9) throws QiniuException {
return asyncFetch(str, str2, new StringMap().putNotNull("key", str3).putNotNull("md5", str4).putNotNull("etag", str5).putNotNull("callbackurl", str6).putNotNull("callbackbody", str7).putNotNull("callbackbodytype", str8).putNotNull("callbackhost", str9).putNotNull("file_type", Integer.valueOf(i9)));
}
public Response copy(String str, String str2, String str3, String str4) throws QiniuException {
Response copy = copy(str, str2, str3, str4, false);
if (copy.isOK()) {
return copy;
}
throw new QiniuException(copy);
}
public Response move(String str, String str2, String str3, String str4) throws QiniuException {
return move(str, str2, str3, str4, false);
}
public BucketManager(Auth auth, Client client) {
this.auth = auth;
this.client = client;
this.configHelper = new ConfigHelper(new Configuration());
}
}