프로젝트
GitHub에서 보기
qiniu/java-sdk
소개
Qiniu 리소스(클라우드) 스토리지용 Java SDK
개발 도구측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalQiniu Resource Storage SDK for Java
安装
下载 the latest JAR 或者 通过 Maven:
<dependency>
<groupId>com.qiniu</groupId>
<artifactId>qiniu-java-sdk</artifactId>
<version>[7.19.0, 7.19.99]</version>
</dependency>
或者 Gradle:
implementation 'com.qiniu:qiniu-java-sdk:7.19.+'
运行环境
JDK 7 及以上
使用方法
上传
// 分片上传 v1
import com.qiniu.storage.UploadManager;
import com.qiniu.util.Auth;
import com.qiniu.storage.Configuration;
import com.qiniu.http.Response;
String accessKey = "Your AccessKey";
String secretKey = "Your SecretKey";
String bucketName = "upload to bucket";
Configuration cfg = Configuration.create();
UploadManager uploadManager = new UploadManager(cfg);
Auth auth = Auth.create(accessKey, secretKey);
String token = auth.uploadToken(bucketName);
String key = "file save key";
Response r = uploadManager.put("hello world".getBytes(), key, token);
// 分片上传 v2
import com.qiniu.storage.UploadManager;
import com.qiniu.util.Auth;
import com.qiniu.storage.Configuration;
import com.qiniu.http.Response;
String accessKey = "Your AccessKey";
String secretKey = "Your SecretKey";
String bucketName = "upload to bucket";
Configuration cfg = Configuration.create();
cfg.resumableUploadAPIVersion = Configuration.ResumableUploadAPIVersion.V2;
UploadManager uploadManager = new UploadManager(cfg);
Auth auth = Auth.create(accessKey, secretKey);
String token = auth.uploadToken(bucketName);
String key = "file save key";
Response r = uploadManager.put("hello world".getBytes(), key, token);
其他使用请参考[开发指南]https://developer.qiniu.com/kodo/1239/java 详细的示例请参考[Examples]https://github.com/qiniu/java-sdk/tree/master/examples
测试
$ ./gradlew build
生成Eclipse工程文件
$ ./gradlew gen_eclipse
常见问题
- QiniuExeption保留了请求响应的信息,失败情况下会抛出此异常,可以提交给我们排查问题。
- API 的使用 demo 可以参考 单元测试。
代码贡献
详情参考代码提交指南。
贡献记录
联系我们
- 如果需要帮助,请提交工单(在portal右侧点击咨询和建议提交工单,或者直接向 [email protected] 发送邮件)
- 如果有什么问题,可以到问答社区提问,问答社区
- 更详细的文档,见官方文档站
- 如果发现了bug, 欢迎提交 issue
- 如果有功能需求,欢迎提交 issue
- 如果要提交代码,欢迎提交 pull request
- 欢迎关注我们的微信 微博,及时获取动态信息。
代码许可
The MIT License (MIT).详情见 License文件.
관련 프로젝트 살펴보기
불러오는 중…