程序包 com.walker.file
类 AbstractFileOperateEngine
java.lang.Object
com.walker.file.AbstractFileOperateEngine
- 所有已实现的接口:
FileOperateEngine
-
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明protected abstract FileInfoacquireFileInfo(String fileName) 获得上传文件结果对象。voidclose()关闭引擎。byte[]downloadFile(String id) 下载单个文件,该方法适用于中小型文件,大文件需要其他方式处理。protected abstract byte[]executeDownload(FileInfo fileInfo) 执行文件下载操作,并返回文件二进制数据。protected abstract voidexecuteUpload(InputStream inputStream, FileInfo fileInfo) 执行上传文件动作,由子类实现。protected StringgenerateSaveFolder(boolean containRoot) 返回要保存文件的目录,系统生成,如: /fileRoot/2023/02/protected StringgetFileName(FileInfo fileInfo) 返回文件名,不带路径,如: demo.txtvoidsetFileRoot(String fileRoot) 设置文件存储的根目录,如: /rootFileFileInfo[]uploadFile(InputStream[] inputStream, String[] fileName, String groupId, long[] fileSize, Integer businessType, String owner) 多个文件上传uploadFile(InputStream inputStream, String fileName, String groupId, long fileSize) 已过时。uploadFile(InputStream inputStream, String fileName, String groupId, long fileSize, Integer businessType, String owner) 文件上传uploadFile(String filePath, String groupId) protected abstract voidwriteFileInfo(FileInfo fileInfo) 把上传成功的文件信息写入到持久层(一般为数据库)中。从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait从接口继承的方法 com.walker.file.FileOperateEngine
getFileInfo, getFileInfoList, getFileStoreType
-
字段详细资料
-
logger
protected final transient org.slf4j.Logger logger
-
-
构造器详细资料
-
AbstractFileOperateEngine
public AbstractFileOperateEngine()
-
-
方法详细资料
-
close
public void close()从接口复制的说明:FileOperateEngine关闭引擎。- 指定者:
close在接口中FileOperateEngine
-
downloadFile
从接口复制的说明:FileOperateEngine下载单个文件,该方法适用于中小型文件,大文件需要其他方式处理。- 指定者:
downloadFile在接口中FileOperateEngine- 参数:
id- 文件id- 返回:
- 返回文件二进制数据
- 抛出:
FileOperateException
-
uploadFile
@Deprecated public FileInfo uploadFile(InputStream inputStream, String fileName, String groupId, long fileSize) throws FileOperateException 已过时。从接口复制的说明:FileOperateEngine上传文件操作- 指定者:
uploadFile在接口中FileOperateEngine- 参数:
inputStream- 文件流fileName- 文件名称,如: demo.txtgroupId- 分组ID,即: 业务ID- 返回:
- 抛出:
FileOperateException
-
uploadFile
public FileInfo[] uploadFile(InputStream[] inputStream, String[] fileName, String groupId, long[] fileSize, Integer businessType, String owner) throws FileOperateException 从接口复制的说明:FileOperateEngine多个文件上传- 指定者:
uploadFile在接口中FileOperateEngine- 返回:
- 返回多个文件结果集合
- 抛出:
FileOperateException
-
uploadFile
public FileInfo uploadFile(InputStream inputStream, String fileName, String groupId, long fileSize, Integer businessType, String owner) throws FileOperateException 从接口复制的说明:FileOperateEngine文件上传- 指定者:
uploadFile在接口中FileOperateEnginefileName- 文件名称,如: demo.txtfileSize- 文件大小businessType- 业务分类(PID),为空表示不存在系统默认:-1owner- 数据归属(商户ID)- 返回:
- 抛出:
FileOperateException
-
uploadFile
- 指定者:
uploadFile在接口中FileOperateEngine- 抛出:
FileOperateException
-
generateSaveFolder
返回要保存文件的目录,系统生成,如: /fileRoot/2023/02/1.对于ftp,url为全路径,因为根路径已在服务中固定,如: /fileRoot/2023/02/ 2.对于磁盘,url为相对路径,根路径依据配置动态拼接,如: 2023/02/- 参数:
containRoot- 是否包含根路径- 返回:
-
getFileName
返回文件名,不带路径,如: demo.txt- 参数:
fileInfo-- 返回:
-
getFileRoot
-
setFileRoot
从接口复制的说明:FileOperateEngine设置文件存储的根目录,如: /rootFile- 指定者:
setFileRoot在接口中FileOperateEngine
-
acquireFileInfo
获得上传文件结果对象。- 参数:
fileName- 文件名,如: demo.txt- 返回:
-
executeUpload
protected abstract void executeUpload(InputStream inputStream, FileInfo fileInfo) throws FileOperateException 执行上传文件动作,由子类实现。- 参数:
inputStream-- 抛出:
FileOperateException
-
writeFileInfo
把上传成功的文件信息写入到持久层(一般为数据库)中。- 参数:
fileInfo-- 抛出:
FileOperateException
-
executeDownload
执行文件下载操作,并返回文件二进制数据。- 参数:
fileInfo-- 返回:
- 抛出:
FileOperateException
-