String accessKey = "your access key";
String secretKey = "your secret key";
Auth auth = Auth.create(accessKey, secretKey);
CdnManager c = new CdnManager(auth);
//待刷新的目录列表,目录必须以 / 结尾
String[] dirs = new String[]{
"http://javasdk.qiniudn.com/gopher1/",
"http://javasdk.qiniudn.com/gopher2/",
//....
};
try {
//单次方法调用刷新的目录不可以超过10个,另外刷新目录权限需要联系技术支持开通
CdnResult.RefreshResult result = c.refreshDirs(dirs);
System.out.println(result.code);
//获取其他的回复内容
} catch (QiniuException e) {
System.err.println(e.response.toString());
}
public static void getRefreshResult() {
String accessKey = "";
String secretKey = "";
String url ="http://fusion.qiniuapi.com/v2/tune/refresh/list";
String body = "{\"urls\":[\"http://p9w3dsbag.bkt.clouddn.com/demo.html\"]}";
Auth auth = Auth.create(accessKey, secretKey);
StringMap str = auth.authorization(url, body.getBytes(), Client.JsonMime);
Client client = new Client();
try {
Response r = client.post(url, body.getBytes(), str);
System.out.println(r.reqId);
System.out.println(r.bodyString());
} catch (QiniuException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
String accessKey = "your access key";
String secretKey = "your secret key";
Auth auth = Auth.create(accessKey, secretKey);
CdnManager c = new CdnManager(auth);
//待预取的文件链接
String[] urls = new String[]{
"http://javasdk.qiniudn.com/gopher1.jpg",
"http://javasdk.qiniudn.com/gopher2.jpg",
//...
};
try {
//单次调用方法预取的链接数量不得超过100个
CdnResult.PrefetchResult result = c.prefetchUrls(urls);
System.out.println(result.code);
//获取其他的回复内容
} catch (QiniuException e) {
System.err.println(e.response.toString());
}
String accessKey = "your access key";
String secretKey = "your secret key";
Auth auth = Auth.create(accessKey, secretKey);
CdnManager c = new CdnManager(auth);
//域名列表
String[] domains = new String[]{
"img1.example.com",
"img2.example.com",
};
//开始和结束日期
String fromDate = "2017-01-02";
String toDate = "2017-01-10";
//数据粒度,支持的取值为 5min / hour /day
String granularity = "day";
try {
CdnResult.FluxResult fluxResult = c.getFluxData(domains, fromDate, toDate, granularity);
//处理得到的结果数据
//...
} catch (QiniuException e) {
System.err.println(e.response.toString());
}
String accessKey = "your access key";
String secretKey = "your secret key";
Auth auth = Auth.create(accessKey, secretKey);
CdnManager c = new CdnManager(auth);
//域名列表
String[] domains = new String[]{
"img1.example.com",
"img2.example.com",
};
//开始和结束日期
String fromDate = "2017-01-02";
String toDate = "2017-01-10";
//数据粒度,支持的取值为 5min / hour /day
String granularity = "day";
try {
CdnResult.BandwidthResult bandwidthResult = c.getBandwidthData(domains, fromDate, toDate, granularity);
//处理得到的结果数据
//...
} catch (QiniuException e) {
System.err.println(e.response.toString());
}
String accessKey = "your access key";
String secretKey = "your secret key";
Auth auth = Auth.create(accessKey, secretKey);
CdnManager c = new CdnManager(auth);
//域名列表
String[] domains = new String[]{
"img1.example.com",
"img2.example.com",
};
//具体日期
String logDate = "2017-01-02";
try {
CdnResult.LogListResult logListResult = c.getCdnLogList(domains, logDate);
//处理得到的结果数据
//...
} catch (QiniuException e) {
System.err.println(e.response.toString());
}
详细硬件可以参考:时间戳防盗链
String host = "http://video.example.com";
String fileName = "基本概括.mp4";
//查询参数
StringMap queryStringMap = new StringMap();
queryStringMap.put("name", "七牛");
queryStringMap.put("year", 2017);
queryStringMap.put("年龄", 28);
//链接过期时间
long deadline = System.currentTimeMillis() / 1000 + 3600;
//签名密钥,从后台域名属性中获取
String encryptKey = "xxx";
String signedUrl;
try {
signedUrl = CdnManager.createTimestampAntiLeechUrl(host, fileName,
queryStringMap, encryptKey, deadline);
System.out.println(signedUrl);
} catch (Exception ex) {
ex.printStackTrace();
}
因为您有任何关于我们文件或品牌的建议和愿望,欢迎您通过以上方法与我们互动讨论:
Fork
创建您的特点分支 git checkout -b my-new-feature
填写您的修改 git commit -am 'Added some feature'
将您的改动记录填写到远程 git 仓库 git push origin my-new-feature
然后到 github 网站的该 git 远程仓库的 my-new-feature 分支下发动 Pull Request
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-118827-6.html
前提是这些男性必须提升自己的颜值和身材
可能是包装破了
就像炒大蒜