本文整理了Java中com.qiniu.android.common.ZoneInfo.<init>()
方法的一些代码示例,展示了ZoneInfo.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZoneInfo.<init>()
方法的具体详情如下:
包路径:com.qiniu.android.common.ZoneInfo
类名称:ZoneInfo
方法名:<init>
暂无
代码示例来源:origin: qiniu/android-sdk
public static ZoneInfo createZoneInfo(String[] upDomains) {
List<String> upDomainsList = new ArrayList<String>();
Map<String, Long> upDomainsMap = new ConcurrentHashMap<String, Long>();
for (String domain : upDomains) {
upDomainsList.add(domain);
upDomainsMap.put(domain, 0L);
}
return new ZoneInfo(0, upDomainsList, upDomainsMap);
}
代码示例来源:origin: com.qiniu/qiniu-android-sdk
public static ZoneInfo createZoneInfo(String[] upDomains) {
List<String> upDomainsList = new ArrayList<String>();
Map<String, Long> upDomainsMap = new ConcurrentHashMap<String, Long>();
for (String domain : upDomains) {
upDomainsList.add(domain);
upDomainsMap.put(domain, 0L);
}
return new ZoneInfo(0, upDomainsList, upDomainsMap);
}
代码示例来源:origin: qiniu/android-sdk
public static ZoneInfo buildFromJson(JSONObject obj) throws JSONException {
int ttl = obj.getInt("ttl");
List<String> domainsList = new ArrayList<>();
ConcurrentHashMap<String, Long> domainsMap = new ConcurrentHashMap<>();
JSONObject upObj = obj.getJSONObject("up");
String[] upDomainTags = new String[]{"acc", "src", "old_acc", "old_src"};
for (String tag : upDomainTags) {
JSONObject tagRootObj = upObj.getJSONObject(tag);
JSONArray tagMainObj = tagRootObj.getJSONArray("main");
for (int i = 0; i < tagMainObj.length(); i++) {
String upDomain = tagMainObj.getString(i);
domainsList.add(upDomain);
domainsMap.put(upDomain, 0L);
}
try {
JSONArray tagBackupObj = tagRootObj.getJSONArray("backup");
if (tagBackupObj != null) {
//this backup tag is optional
for (int i = 0; i < tagBackupObj.length(); i++) {
String upHost = tagBackupObj.getString(i);
domainsList.add(upHost);
domainsMap.put(upHost, 0L);
}
}
} catch (JSONException ex) {
//some zone has not backup domain, just ignore here
}
}
return new ZoneInfo(ttl, domainsList, domainsMap);
}
代码示例来源:origin: com.qiniu/qiniu-android-sdk
public static ZoneInfo buildFromJson(JSONObject obj) throws JSONException {
int ttl = obj.getInt("ttl");
List<String> domainsList = new ArrayList<>();
ConcurrentHashMap<String, Long> domainsMap = new ConcurrentHashMap<>();
JSONObject upObj = obj.getJSONObject("up");
String[] upDomainTags = new String[]{"acc", "src", "old_acc", "old_src"};
for (String tag : upDomainTags) {
JSONObject tagRootObj = upObj.getJSONObject(tag);
JSONArray tagMainObj = tagRootObj.getJSONArray("main");
for (int i = 0; i < tagMainObj.length(); i++) {
String upDomain = tagMainObj.getString(i);
domainsList.add(upDomain);
domainsMap.put(upDomain, 0L);
}
try {
JSONArray tagBackupObj = tagRootObj.getJSONArray("backup");
if (tagBackupObj != null) {
//this backup tag is optional
for (int i = 0; i < tagBackupObj.length(); i++) {
String upHost = tagBackupObj.getString(i);
domainsList.add(upHost);
domainsMap.put(upHost, 0L);
}
}
} catch (JSONException ex) {
//some zone has not backup domain, just ignore here
}
}
return new ZoneInfo(ttl, domainsList, domainsMap);
}
内容来源于网络,如有侵权,请联系作者删除!