fix: minio存储桶的增删改查,数据的增删改查
This commit is contained in:
@@ -72,7 +72,214 @@ public class SchisandraOssMinioController {
|
||||
log.error("用户: " + userId + "-> minio 初始化完成!");
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @description: 获取文件目录信息
|
||||
* @param: [target, userId, dirName]
|
||||
* @return: com.schisandra.oss.common.entity.Result<java.lang.String>
|
||||
* @author zlg
|
||||
* @date: 2024/6/26 13:55
|
||||
*/
|
||||
@GetMapping("listMinioDir")
|
||||
public Result<String> listMinioInfo(@RequestParam String target, @RequestParam String userId, @RequestParam String dirName,@RequestParam String bucket) throws Exception {
|
||||
Preconditions.checkNotNull(target, "不能为空");
|
||||
Preconditions.checkNotNull(userId, "不能为空");
|
||||
MinioOssClient bean = SpringUtil.getBean(userId);
|
||||
bean.getMinioOssConfig().setBucketName(bucket);
|
||||
return Result.ok(bean.listDir(target, dirName));
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 下载文件
|
||||
* @param: [schisandraOssMinioDTO]
|
||||
* @return: void
|
||||
* @author zlg
|
||||
* @date: 2024/6/26 13:56
|
||||
*/
|
||||
@GetMapping("downloadMinioFile")
|
||||
public void getMinioFile(@RequestParam String bucket, @RequestParam String userId, @RequestParam String filePath, HttpServletResponse response) throws Exception {
|
||||
Preconditions.checkNotNull(bucket, "不能为空");
|
||||
Preconditions.checkNotNull(userId, "不能为空");
|
||||
Preconditions.checkNotNull(filePath, "不能为空");
|
||||
MinioOssClient bean = SpringUtil.getBean(userId);
|
||||
bean.getMinioOssConfig().setBucketName(bucket);
|
||||
InputStream stream = bean.getMinioObject(bucket, filePath);
|
||||
ServletOutputStream output = response.getOutputStream();
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(filePath.substring(filePath.lastIndexOf("/") + 1), "UTF-8"));
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
IOUtils.copy(stream, output);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 删除文件
|
||||
* @param: [schisandraOssMinioDTO]
|
||||
* @return: void
|
||||
* @author zlg
|
||||
* @date: 2024/6/26 14:34
|
||||
*/
|
||||
@PostMapping("deleteMinioFile")
|
||||
public Result deleteMinioFile(@RequestParam String bucket, @RequestParam String userId, @RequestParam String filePath) {
|
||||
Preconditions.checkNotNull(bucket, "不能为空");
|
||||
Preconditions.checkNotNull(userId, "不能为空");
|
||||
Preconditions.checkNotNull(filePath, "不能为空");
|
||||
MinioOssClient bean = SpringUtil.getBean(userId);
|
||||
bean.getMinioOssConfig().setBucketName(bucket);
|
||||
bean.delete(filePath);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 上传文件
|
||||
* @param: [schisandraOssMinioDTO]
|
||||
* @return: void
|
||||
* @author zlg
|
||||
* @date: 2024/6/26 14:34
|
||||
*/
|
||||
@PostMapping("uploadMinioFile")
|
||||
public Result<OssInfo> uploadMinioFile(@RequestParam String userId, @RequestParam MultipartFile file, @RequestParam String fileName, @RequestParam String bucket) throws IOException {
|
||||
Preconditions.checkNotNull(userId, "不能为空");
|
||||
Preconditions.checkNotNull(fileName, "不能为空");
|
||||
Preconditions.checkNotNull(bucket, "不能为空");
|
||||
// 获取文件输入流
|
||||
InputStream is = file.getInputStream();
|
||||
MinioOssClient bean = SpringUtil.getBean(userId);
|
||||
bean.getMinioOssConfig().setBucketName(bucket);
|
||||
return Result.ok(bean.upLoad(is, fileName, true));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description: 重命名文件
|
||||
* @param: [userId, bucket, oldFileName, newFileName]
|
||||
* @return: com.schisandra.oss.common.entity.Result
|
||||
* @author zlg
|
||||
* @date: 2024/6/27 9:41
|
||||
*/
|
||||
@PostMapping("renameMinioFile")
|
||||
public Result renameMinioFile(@RequestParam String userId, @RequestParam String bucket, @RequestParam String oldFileName, @RequestParam String newFileName) throws IOException {
|
||||
|
||||
Preconditions.checkNotNull(userId, "不能为空");
|
||||
Preconditions.checkNotNull(bucket, "不能为空");
|
||||
Preconditions.checkNotNull(oldFileName, "不能为空");
|
||||
Preconditions.checkNotNull(newFileName, "不能为空");
|
||||
MinioOssClient bean = SpringUtil.getBean(userId);
|
||||
bean.getMinioOssConfig().setBucketName(bucket);
|
||||
try {
|
||||
bean.rename(oldFileName, newFileName);
|
||||
}catch (Exception e){
|
||||
return Result.fail(e.getMessage());
|
||||
}
|
||||
return Result.ok();
|
||||
}
|
||||
/**
|
||||
* @description: 拷贝文件
|
||||
* @param: [userId, bucket, oldFilePath, newFilePath]
|
||||
* @return: com.schisandra.oss.common.entity.Result
|
||||
* @author zlg
|
||||
* @date: 2024/6/27 9:52
|
||||
*/
|
||||
@PostMapping("copyMinioFile")
|
||||
public Result copyMinioFile(@RequestParam String userId, @RequestParam String bucket, @RequestParam String oldFilePath, @RequestParam String newFilePath) throws IOException {
|
||||
|
||||
Preconditions.checkNotNull(userId, "不能为空");
|
||||
Preconditions.checkNotNull(bucket, "不能为空");
|
||||
Preconditions.checkNotNull(oldFilePath, "不能为空");
|
||||
Preconditions.checkNotNull(newFilePath, "不能为空");
|
||||
MinioOssClient bean = SpringUtil.getBean(userId);
|
||||
bean.getMinioOssConfig().setBucketName(bucket);
|
||||
try {
|
||||
bean.copy(oldFilePath, newFilePath);
|
||||
}catch (Exception e){
|
||||
return Result.fail(e.getMessage());
|
||||
}
|
||||
return Result.ok();
|
||||
}
|
||||
/**
|
||||
* @description: 预览文件
|
||||
* @param: [userId, bucket, filePath]
|
||||
* @return: com.schisandra.oss.common.entity.Result<java.lang.String>
|
||||
* @author zlg
|
||||
* @date: 2024/6/27 10:14
|
||||
*/
|
||||
@PostMapping("previewMinioFile")
|
||||
public Result<String> previewMinioFile(@RequestParam String userId, @RequestParam String bucket, @RequestParam String filePath) throws IOException {
|
||||
Preconditions.checkNotNull(userId, "不能为空");
|
||||
Preconditions.checkNotNull(bucket, "不能为空");
|
||||
Preconditions.checkNotNull(filePath, "不能为空");
|
||||
MinioOssClient bean = SpringUtil.getBean(userId);
|
||||
bean.getMinioOssConfig().setBucketName(bucket);
|
||||
try {
|
||||
return Result.ok(bean.getMinioPreviewUrl(filePath));
|
||||
} catch (Exception e) {
|
||||
return Result.fail(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* @description: 分享文件
|
||||
* @param: [userId, bucket, filePath]
|
||||
* @return: com.schisandra.oss.common.entity.Result<java.lang.String>
|
||||
* @author zlg
|
||||
* @date: 2024/6/27 10:17
|
||||
*/
|
||||
@PostMapping("shareMinioFile")
|
||||
public Result<String> shareMinioFile(@RequestParam String userId, @RequestParam String bucket, @RequestParam String filePath, @RequestParam int time) throws IOException {
|
||||
Preconditions.checkNotNull(userId, "不能为空");
|
||||
Preconditions.checkNotNull(bucket, "不能为空");
|
||||
Preconditions.checkNotNull(filePath, "不能为空");
|
||||
MinioOssClient bean = SpringUtil.getBean(userId);
|
||||
bean.getMinioOssConfig().setBucketName(bucket);
|
||||
try {
|
||||
return Result.ok(bean.shareMinioFile(filePath,time));
|
||||
} catch (Exception e) {
|
||||
return Result.fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 获取所有bucket
|
||||
* @param: [userId, bucket]
|
||||
* @return: com.schisandra.oss.common.entity.Result<java.lang.String>
|
||||
* @author zlg
|
||||
* @date: 2024/6/26 17:37
|
||||
*/
|
||||
@PostMapping("seleteBucket")
|
||||
public Result<String> seleteBucket(@RequestParam String userId) throws ServerException, InsufficientDataException, ErrorResponseException, IOException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException {
|
||||
Preconditions.checkNotNull(userId, "不能为空");
|
||||
MinioOssClient bean = SpringUtil.getBean(userId);
|
||||
return Result.ok(bean.selectAllBucket());
|
||||
}
|
||||
/**
|
||||
* @description: 创建bucket
|
||||
* @param: [userId, bucket]
|
||||
* @return: com.schisandra.oss.common.entity.Result<java.lang.String>
|
||||
* @author zlg
|
||||
* @date: 2024/6/26 17:38
|
||||
*/
|
||||
@PostMapping("createBucket")
|
||||
public Result<String> createBucket(@RequestParam String userId, @RequestParam String bucket) {
|
||||
Preconditions.checkNotNull(userId, "不能为空");
|
||||
Preconditions.checkNotNull(bucket, "不能为空");
|
||||
MinioOssClient bean = SpringUtil.getBean(userId);
|
||||
bean.getMinioOssConfig().setBucketName(bucket);
|
||||
return Result.ok(bean.createBucket(bucket));
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 删除bucket
|
||||
* @param: [userId, bucket]
|
||||
* @return: com.schisandra.oss.common.entity.Result<java.lang.String>
|
||||
* @author zlg
|
||||
* @date: 2024/6/26 17:38
|
||||
*/
|
||||
@PostMapping("deleteBucket")
|
||||
public Result<String> deleteBucket(@RequestParam String userId, @RequestParam String bucket) {
|
||||
Preconditions.checkNotNull(userId, "不能为空");
|
||||
Preconditions.checkNotNull(bucket, "不能为空");
|
||||
MinioOssClient bean = SpringUtil.getBean(userId);
|
||||
bean.getMinioOssConfig().setBucketName(bucket);
|
||||
return Result.ok(bean.deleteBucket(bucket));
|
||||
}
|
||||
@PostMapping("get")
|
||||
public SchisandraOssMinioDTO getMinioOss(@RequestParam String userId) {
|
||||
return SchisandraOssMinioDTOConverter.INSTANCE.convertBOToDTO(schisandraOssMinioDomainService.getMinioConfig(Long.valueOf(userId)));
|
||||
@@ -157,124 +364,8 @@ public class SchisandraOssMinioController {
|
||||
return Result.ok(schisandraOssMinioDTOS);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 获取文件目录信息
|
||||
* @param: [target, userId, dirName]
|
||||
* @return: com.schisandra.oss.common.entity.Result<java.lang.String>
|
||||
* @author zlg
|
||||
* @date: 2024/6/26 13:55
|
||||
*/
|
||||
@GetMapping("listMinioDir")
|
||||
public Result<String> listMinioInfo(@RequestParam String target, @RequestParam String userId, @RequestParam String dirName,@RequestParam String bucket) throws Exception {
|
||||
Preconditions.checkNotNull(target, "不能为空");
|
||||
Preconditions.checkNotNull(userId, "不能为空");
|
||||
MinioOssClient bean = SpringUtil.getBean(userId);
|
||||
bean.getMinioOssConfig().setBucketName(bucket);
|
||||
return Result.ok(bean.listDir(target, dirName));
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 下载文件
|
||||
* @param: [schisandraOssMinioDTO]
|
||||
* @return: void
|
||||
* @author zlg
|
||||
* @date: 2024/6/26 13:56
|
||||
*/
|
||||
@GetMapping("downloadMinioFile")
|
||||
public void getMinioFile(@RequestParam String bucket, @RequestParam String userId, @RequestParam String filePath, HttpServletResponse response) throws Exception {
|
||||
Preconditions.checkNotNull(bucket, "不能为空");
|
||||
Preconditions.checkNotNull(userId, "不能为空");
|
||||
Preconditions.checkNotNull(filePath, "不能为空");
|
||||
MinioOssClient bean = SpringUtil.getBean(userId);
|
||||
bean.getMinioOssConfig().setBucketName(bucket);
|
||||
InputStream stream = bean.getMinioObject(bucket, filePath);
|
||||
ServletOutputStream output = response.getOutputStream();
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(filePath.substring(filePath.lastIndexOf("/") + 1), "UTF-8"));
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
IOUtils.copy(stream, output);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 删除文件
|
||||
* @param: [schisandraOssMinioDTO]
|
||||
* @return: void
|
||||
* @author zlg
|
||||
* @date: 2024/6/26 14:34
|
||||
*/
|
||||
@PostMapping("deleteMinioFile")
|
||||
public Result deleteMinioFile(@RequestParam String bucket, @RequestParam String userId, @RequestParam String filePath) {
|
||||
Preconditions.checkNotNull(bucket, "不能为空");
|
||||
Preconditions.checkNotNull(userId, "不能为空");
|
||||
Preconditions.checkNotNull(filePath, "不能为空");
|
||||
MinioOssClient bean = SpringUtil.getBean(userId);
|
||||
bean.getMinioOssConfig().setBucketName(bucket);
|
||||
bean.delete(filePath);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 上传文件
|
||||
* @param: [schisandraOssMinioDTO]
|
||||
* @return: void
|
||||
* @author zlg
|
||||
* @date: 2024/6/26 14:34
|
||||
*/
|
||||
@PostMapping("uploadMinioFile")
|
||||
public Result<OssInfo> uploadMinioFile(@RequestParam String userId, @RequestParam MultipartFile file, @RequestParam String fileName, @RequestParam String bucket) throws IOException {
|
||||
Preconditions.checkNotNull(userId, "不能为空");
|
||||
Preconditions.checkNotNull(fileName, "不能为空");
|
||||
Preconditions.checkNotNull(bucket, "不能为空");
|
||||
// 获取文件输入流
|
||||
InputStream is = file.getInputStream();
|
||||
MinioOssClient bean = SpringUtil.getBean(userId);
|
||||
bean.getMinioOssConfig().setBucketName(bucket);
|
||||
return Result.ok(bean.upLoad(is, fileName, true));
|
||||
}
|
||||
/**
|
||||
* @description: 获取所有bucket
|
||||
* @param: [userId, bucket]
|
||||
* @return: com.schisandra.oss.common.entity.Result<java.lang.String>
|
||||
* @author zlg
|
||||
* @date: 2024/6/26 17:37
|
||||
*/
|
||||
@PostMapping("seleteBucket")
|
||||
public Result<String> seleteBucket(@RequestParam String userId) throws ServerException, InsufficientDataException, ErrorResponseException, IOException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException {
|
||||
Preconditions.checkNotNull(userId, "不能为空");
|
||||
MinioOssClient bean = SpringUtil.getBean(userId);
|
||||
return Result.ok(bean.selectAllBucket());
|
||||
}
|
||||
/**
|
||||
* @description: 创建bucket
|
||||
* @param: [userId, bucket]
|
||||
* @return: com.schisandra.oss.common.entity.Result<java.lang.String>
|
||||
* @author zlg
|
||||
* @date: 2024/6/26 17:38
|
||||
*/
|
||||
@PostMapping("createBucket")
|
||||
public Result<String> createBucket(@RequestParam String userId, @RequestParam String bucket) {
|
||||
Preconditions.checkNotNull(userId, "不能为空");
|
||||
Preconditions.checkNotNull(bucket, "不能为空");
|
||||
MinioOssClient bean = SpringUtil.getBean(userId);
|
||||
bean.getMinioOssConfig().setBucketName(bucket);
|
||||
return Result.ok(bean.createBucket(bucket));
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 删除bucket
|
||||
* @param: [userId, bucket]
|
||||
* @return: com.schisandra.oss.common.entity.Result<java.lang.String>
|
||||
* @author zlg
|
||||
* @date: 2024/6/26 17:38
|
||||
*/
|
||||
@PostMapping("deleteBucket")
|
||||
public Result<String> deleteBucket(@RequestParam String userId, @RequestParam String bucket) {
|
||||
Preconditions.checkNotNull(userId, "不能为空");
|
||||
Preconditions.checkNotNull(bucket, "不能为空");
|
||||
MinioOssClient bean = SpringUtil.getBean(userId);
|
||||
bean.getMinioOssConfig().setBucketName(bucket);
|
||||
return Result.ok(bean.deleteBucket(bucket));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@@ -6,6 +6,7 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.io.file.FileNameUtil;
|
||||
import cn.hutool.core.io.unit.DataSizeUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.ReflectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
@@ -23,6 +24,7 @@ import com.schisandra.oss.application.oss.model.download.DownloadObjectStat;
|
||||
import com.schisandra.oss.application.oss.utils.OssPathUtil;
|
||||
import io.minio.*;
|
||||
import io.minio.errors.*;
|
||||
import io.minio.http.Method;
|
||||
import io.minio.messages.Bucket;
|
||||
import io.minio.messages.Item;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -39,6 +41,7 @@ import java.io.OutputStream;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* http://docs.minio.org.cn/docs/master/minio-monitoring-guide
|
||||
@@ -61,7 +64,6 @@ public class MinioOssClient implements StandardOssClient {
|
||||
private MinioOssConfig minioOssConfig;
|
||||
|
||||
|
||||
|
||||
public MinioOssConfig getMinioOssConfig() {
|
||||
return minioOssConfig;
|
||||
}
|
||||
@@ -69,12 +71,58 @@ public class MinioOssClient implements StandardOssClient {
|
||||
public void setMinioOssConfig(MinioOssConfig minioOssConfig) {
|
||||
this.minioOssConfig = minioOssConfig;
|
||||
}
|
||||
public String createBucket(String bucketName) {
|
||||
|
||||
|
||||
public String getMinioBucketSize(String bucket) {
|
||||
Iterable<Result<Item>> results =
|
||||
minioClient.listObjects(
|
||||
ListObjectsArgs.builder().bucket(bucket).recursive(true).build());
|
||||
final long[] totalSize = {0};
|
||||
final Item[] item = {null};
|
||||
results.forEach(result -> {
|
||||
try {
|
||||
item[0] = result.get();
|
||||
totalSize[0] = item[0].size() + totalSize[0];
|
||||
} catch (Exception e) {
|
||||
log.error("listObjects error", e);
|
||||
}
|
||||
});
|
||||
return String.valueOf(DataSizeUtil.format(totalSize[0]));
|
||||
}
|
||||
|
||||
public String getMinioPreviewUrl(String fileName) throws ServerException, InsufficientDataException, ErrorResponseException, IOException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException {
|
||||
String presignedUrl = null;
|
||||
presignedUrl = minioClient.getPresignedObjectUrl(
|
||||
GetPresignedObjectUrlArgs.builder()
|
||||
.method(Method.GET)
|
||||
.bucket(getBucket())
|
||||
.object(fileName)
|
||||
.expiry(1, TimeUnit.DAYS)
|
||||
.build());
|
||||
return presignedUrl;
|
||||
}
|
||||
|
||||
public String shareMinioFile(String fileName, int time) {
|
||||
String presignedUrl = null;
|
||||
try {
|
||||
presignedUrl = minioClient.getPresignedObjectUrl(
|
||||
GetPresignedObjectUrlArgs.builder()
|
||||
.method(Method.GET)
|
||||
.bucket(getBucket())
|
||||
.object(fileName)
|
||||
.expiry(time)
|
||||
.build());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return presignedUrl;
|
||||
}
|
||||
|
||||
public String createBucket(String bucketName) {
|
||||
try {
|
||||
if (!minioClient.bucketExists(BucketExistsArgs.builder().bucket(bucketName).build())) {
|
||||
minioClient.makeBucket(MakeBucketArgs.builder().bucket(bucketName).build());
|
||||
}else {
|
||||
} else {
|
||||
return "bucket already exists";
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@@ -82,27 +130,29 @@ public class MinioOssClient implements StandardOssClient {
|
||||
}
|
||||
return bucketName;
|
||||
}
|
||||
|
||||
public String deleteBucket(String bucketName) {
|
||||
try {
|
||||
if (minioClient.bucketExists(BucketExistsArgs.builder().bucket(bucketName).build())){
|
||||
if (minioClient.bucketExists(BucketExistsArgs.builder().bucket(bucketName).build())) {
|
||||
minioClient.removeBucket(RemoveBucketArgs.builder().bucket(bucketName).build());
|
||||
}else {
|
||||
} else {
|
||||
return "bucket not exists";
|
||||
}
|
||||
}catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "success";
|
||||
}
|
||||
|
||||
public List<String> selectAllBucket() throws ServerException, InsufficientDataException, ErrorResponseException, IOException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException {
|
||||
public HashMap<String, String> selectAllBucket() throws ServerException, InsufficientDataException, ErrorResponseException, IOException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException {
|
||||
List<Bucket> list = minioClient.listBuckets();
|
||||
List<String> names = new ArrayList<>();
|
||||
HashMap<String, String> names = new HashMap<>();
|
||||
list.forEach(bucket -> {
|
||||
names.add(bucket.name());
|
||||
names.put(bucket.name(), getMinioBucketSize(bucket.name()));
|
||||
});
|
||||
return names;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 获取目录文件信息
|
||||
* @param: [bucket, dirName]
|
||||
@@ -144,6 +194,7 @@ public class MinioOssClient implements StandardOssClient {
|
||||
});
|
||||
return infos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OssInfo upLoad(InputStream is, String targetName, Boolean isOverride) {
|
||||
try {
|
||||
@@ -274,6 +325,7 @@ public class MinioOssClient implements StandardOssClient {
|
||||
throw new OssException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public InputStream getMinioObject(String bucket, String dirName) throws ServerException, InsufficientDataException, ErrorResponseException, IOException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException {
|
||||
InputStream stream = minioClient.getObject(
|
||||
GetObjectArgs.builder().bucket(bucket).object(dirName).build());
|
||||
@@ -374,4 +426,5 @@ public class MinioOssClient implements StandardOssClient {
|
||||
return ossInfo;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -9,7 +9,6 @@
|
||||
|
||||
<artifactId>schisandra-cloud-storage-oss-common</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>schisandra-cloud-storage-oss-common</name>
|
||||
|
||||
<properties>
|
||||
@@ -124,11 +123,12 @@
|
||||
<artifactId>minio</artifactId>
|
||||
<version>8.2.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 阿里云 -->
|
||||
<dependency>
|
||||
<groupId>com.aliyun.oss</groupId>
|
||||
<artifactId>aliyun-sdk-oss</artifactId>
|
||||
<version>3.14.0</version>
|
||||
<version>3.17.4</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 亚马逊 -->
|
||||
|
Reference in New Issue
Block a user