# java-cloud-storage-service
**Repository Path**: shih945/java-cloud-storage-service
## Basic Information
- **Project Name**: java-cloud-storage-service
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2021-12-01
- **Last Updated**: 2021-12-01
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# java-cloud-storage-service
七牛云、又拍云、阿里云对象存储OSS、腾讯云对象存储服务COS,Java文件上传客户端。
## Maven依赖使用方式
首先加入java-cloud-storage-service依赖包:
```
xxg-repository
http://repo.maven.xxgblog.com/
```
```
com.xxg
cloudstorage
1.2.2
```
再根据实际所使用的云存储提供商加入对应的依赖:
七牛:
```
com.qiniu
qiniu-java-sdk
[7.0.0, 7.0.99]
```
阿里云对象存储OSS:
```
com.aliyun.oss
aliyun-sdk-oss
2.3.0
```
又拍云:
```
com.upyun
java-sdk
3.10
```
腾讯云对象存储服务COS:
```
com.qcloud
cos_api
3.3
```
## 七牛云
### 文档
http://developer.qiniu.com/code/v7/sdk/java.html
### 文件上传代码
```
String httpBase = "http://o8sw7lrki.bkt.clouddn.com/"; // 云存储HTTP地址
String target = "your/path/test.png"; // 上传到云存储的目标路径
String filePath = "/Users/wucao/Desktop/test.png"; // 本地文件
QiniuConfig qiniuConfig = new QiniuConfig();
qiniuConfig.setAccessKey("");
qiniuConfig.setSecretKey("");
qiniuConfig.setBucket("");
QiniuCloudStorageService cloudStorageService = new QiniuCloudStorageService();
cloudStorageService.setQiniuConfig(qiniuConfig);
cloudStorageService.upload(new File(filePath), target);
System.out.println("文件HTTP地址: " + httpBase + target);
```
### 使用Spring
```
```
## 阿里云对象存储OSS
### 文档
https://help.aliyun.com/document_detail/32008.html?spm=5176.doc32008.3.3.3YkvaP
### 文件上传代码
待补充
### 使用Spring
待补充
## 又拍云
### 文档
https://github.com/upyun/java-sdk
### 文件上传代码
待补充
### 使用Spring
待补充
## 腾讯云对象存储服务COS
### 文档
https://www.qcloud.com/doc/product/430/5944
### 文件上传代码
待补充
### 使用Spring
待补充
## 不重复文件名上传工具
该工具通过UUID生成唯一不重复的文件名,上传文件成功时返回对应的HTTP地址。
### 文件上传代码
待补充
### 使用Spring
待补充