public class FileStorageService extends Object
| 构造器和说明 |
|---|
FileStorageService() |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
delete(FileInfo fileInfo)
根据条件
|
boolean |
delete(FileInfo fileInfo,
java.util.function.Predicate<FileInfo> predicate)
根据条件删除文件
|
boolean |
delete(String url)
根据 url 删除文件
|
boolean |
delete(String url,
java.util.function.Predicate<FileInfo> predicate)
根据 url 删除文件
|
void |
destroy() |
Downloader |
download(FileInfo fileInfo)
获取文件下载器
|
Downloader |
download(String url)
获取文件下载器
|
Downloader |
downloadTh(FileInfo fileInfo)
获取缩略图文件下载器
|
Downloader |
downloadTh(String url)
获取缩略图文件下载器
|
boolean |
exists(FileInfo fileInfo)
文件是否存在
|
boolean |
exists(String url)
文件是否存在
|
String |
generatePresignedUrl(FileInfo fileInfo,
Date expiration)
对文件生成可以签名访问的 URL,无法生成则返回 null
|
String |
generateThPresignedUrl(FileInfo fileInfo,
Date expiration)
对缩略图文件生成可以签名访问的 URL,无法生成则返回 null
|
FileInfo |
getFileInfoByUrl(String url)
根据 url 获取 FileInfo
|
<T extends FileStorage> |
getFileStorage()
获取默认的存储平台
|
<T extends FileStorage> |
getFileStorage(String platform)
获取对应的存储平台
|
<T extends FileStorage> |
getFileStorageVerify(FileInfo fileInfo)
获取对应的存储平台,如果存储平台不存在则抛出异常
|
<T extends FileStorage> |
getFileStorageVerify(String platform)
获取对应的存储平台,如果存储平台不存在则抛出异常
|
<T> T |
invoke(FileStorage platform,
String method,
Object... args)
通过反射调用指定存储平台的方法
详情见
ReflectUtil.invoke(Object,String,Object...) |
<T> T |
invoke(String platform,
String method,
Object... args)
通过反射调用指定存储平台的方法
详情见
ReflectUtil.invoke(Object,String,Object...) |
boolean |
isSupportAcl(FileStorage fileStorage)
是否支持对文件的访问控制列表
|
boolean |
isSupportAcl(String platform)
是否支持对文件的访问控制列表
|
boolean |
isSupportMetadata(FileStorage fileStorage)
是否支持 Metadata
|
boolean |
isSupportMetadata(String platform)
是否支持 Metadata
|
boolean |
isSupportPresignedUrl(FileStorage fileStorage)
是否支持对文件生成可以签名访问的 URL
|
boolean |
isSupportPresignedUrl(String platform)
是否支持对文件生成可以签名访问的 URL
|
UploadPretreatment |
of()
创建上传预处理器
|
UploadPretreatment |
of(Object source)
创建上传预处理器
|
UploadPretreatment |
of(Object source,
String name)
创建上传预处理器
|
UploadPretreatment |
of(Object source,
String name,
String contentType)
创建上传预处理器
|
UploadPretreatment |
of(Object source,
String name,
String contentType,
Long size)
创建上传预处理器
|
boolean |
setFileAcl(FileInfo fileInfo,
Object acl)
设置文件的访问控制列表,一般情况下只有对象存储支持该功能
详情见
FileInfo#setFileAcl |
boolean |
setThFileAcl(FileInfo fileInfo,
Object acl)
设置缩略图文件的访问控制列表,一般情况下只有对象存储支持该功能
详情见
FileInfo#setFileAcl |
FileInfo |
upload(UploadPretreatment pre)
上传文件,成功返回文件信息,失败返回 null
|
FileWrapper |
wrapper(Object source)
对要上传的文件进行包装
|
FileWrapper |
wrapper(Object source,
String name)
对要上传的文件进行包装
|
FileWrapper |
wrapper(Object source,
String name,
String contentType)
对要上传的文件进行包装
|
FileWrapper |
wrapper(Object source,
String name,
String contentType,
Long size)
对要上传的文件进行包装
|
public <T extends FileStorage> T getFileStorage()
public <T extends FileStorage> T getFileStorage(String platform)
public <T extends FileStorage> T getFileStorageVerify(FileInfo fileInfo)
public <T extends FileStorage> T getFileStorageVerify(String platform)
public FileInfo upload(UploadPretreatment pre)
public boolean delete(String url)
public boolean delete(String url, java.util.function.Predicate<FileInfo> predicate)
public boolean delete(FileInfo fileInfo)
public boolean delete(FileInfo fileInfo, java.util.function.Predicate<FileInfo> predicate)
public boolean exists(String url)
public boolean exists(FileInfo fileInfo)
public Downloader download(FileInfo fileInfo)
public Downloader download(String url)
public Downloader downloadTh(FileInfo fileInfo)
public Downloader downloadTh(String url)
public boolean isSupportPresignedUrl(String platform)
public boolean isSupportPresignedUrl(FileStorage fileStorage)
public String generatePresignedUrl(FileInfo fileInfo, Date expiration)
expiration - 到期时间public String generateThPresignedUrl(FileInfo fileInfo, Date expiration)
expiration - 到期时间public boolean isSupportAcl(String platform)
public boolean isSupportAcl(FileStorage fileStorage)
public boolean setFileAcl(FileInfo fileInfo, Object acl)
FileInfo#setFileAclpublic boolean setThFileAcl(FileInfo fileInfo, Object acl)
FileInfo#setFileAclpublic boolean isSupportMetadata(String platform)
public boolean isSupportMetadata(FileStorage fileStorage)
public UploadPretreatment of()
public UploadPretreatment of(Object source)
source - 源public UploadPretreatment of(Object source, String name)
source - 源name - 文件名public UploadPretreatment of(Object source, String name, String contentType)
source - 源name - 文件名contentType - 文件的 MIME 类型public UploadPretreatment of(Object source, String name, String contentType, Long size)
source - 源name - 文件名contentType - 文件的 MIME 类型size - 文件大小public FileWrapper wrapper(Object source)
source - 源public FileWrapper wrapper(Object source, String name)
source - 源name - 文件名public FileWrapper wrapper(Object source, String name, String contentType)
source - 源name - 文件名public FileWrapper wrapper(Object source, String name, String contentType, Long size)
source - 源name - 文件名contentType - 文件的 MIME 类型size - 文件大小public <T> T invoke(String platform, String method, Object... args)
ReflectUtil.invoke(Object,String,Object...)public <T> T invoke(FileStorage platform, String method, Object... args)
ReflectUtil.invoke(Object,String,Object...)public void destroy()
Copyright © 2023. All rights reserved.