public class OperateFileUtil extends Object
| 构造器和说明 |
|---|
OperateFileUtil(io.minio.MinioClient minioClient,
OSSConfig minIoConfig) |
| 限定符和类型 | 方法和说明 |
|---|---|
Iterable<io.minio.Result<io.minio.messages.Item>> |
allListObjects(String bucket,
String childFolder)
获取指定位置下的所有文件(递归循环出所有文件,不包含文件夹)
|
boolean |
bucketExists(String bucket)
检查存储桶是否存在
|
void |
copyObject(String bucket,
String objectName,
String sourceBucket,
String sourceObjectName)
复制文件
|
void |
download(javax.servlet.http.HttpServletResponse response,
String bucket,
String objectName)
下载文件
|
String |
getExpiryObjectUrl(String bucket,
String objectName,
Integer expires)
生成一个有效时间内的访问连接
|
InputStream |
getObject(String bucket,
String objectName)
获取对象的数据。
|
List<io.minio.messages.Bucket> |
listBuckets()
列出所有存储桶
|
Iterable<io.minio.Result<io.minio.messages.Item>> |
listObjects(String bucket,
String childFolder)
获取指定位置下的文件(也可能是文件夹)
|
void |
makeBucket(String bucket)
创建一个新的存储桶
|
void |
removeBucket(String bucketName)
删除桶
|
void |
removeObject(String bucket,
String objectName)
删除一个对象
|
List<String> |
removeObjects(String bucket,
List<String> objectNames)
删除指定桶的多个文件对象,返回删除错误的对象列表,全部删除成功,返回空列表
|
io.minio.StatObjectResponse |
statObject(String bucket,
String objectName)
获取对象信息和对象的元数据
|
FilePathResult |
uploadFile(org.springframework.web.multipart.MultipartFile file,
String fileName,
String bucket,
String childFolder)
文件上传,成功后返回相对地址,需要自己加上minio的url
|
FilePathResult |
uploadFile(String objJson,
String bucket,
String objectName)
创建文本文件
|
public OperateFileUtil(io.minio.MinioClient minioClient,
OSSConfig minIoConfig)
public boolean bucketExists(String bucket) throws Exception
Exceptionpublic void makeBucket(String bucket) throws Exception
Exceptionpublic List<io.minio.messages.Bucket> listBuckets() throws Exception
Exceptionpublic void removeBucket(String bucketName) throws Exception
Exceptionpublic FilePathResult uploadFile(org.springframework.web.multipart.MultipartFile file, String fileName, String bucket, String childFolder) throws Exception
Exceptionpublic FilePathResult uploadFile(String objJson, String bucket, String objectName) throws Exception
Exceptionpublic Iterable<io.minio.Result<io.minio.messages.Item>> listObjects(String bucket, String childFolder) throws Exception
Exceptionpublic Iterable<io.minio.Result<io.minio.messages.Item>> allListObjects(String bucket, String childFolder) throws Exception
Exceptionpublic io.minio.StatObjectResponse statObject(String bucket, String objectName) throws Exception
Exceptionpublic InputStream getObject(String bucket, String objectName) throws Exception
Exceptionpublic void copyObject(String bucket, String objectName, String sourceBucket, String sourceObjectName) throws Exception
Exceptionpublic void download(javax.servlet.http.HttpServletResponse response,
String bucket,
String objectName)
throws Exception
Exceptionpublic String getExpiryObjectUrl(String bucket, String objectName, Integer expires) throws Exception
Exceptionpublic void removeObject(String bucket, String objectName) throws Exception
ExceptionCopyright © 2023 tan. All rights reserved.