类 SohelpFileDownloadService

java.lang.Object
net.sohelp.boot.admin.core.service.file.SohelpFileDownloadService

@Service public class SohelpFileDownloadService extends Object
文件下载操作服务类,提供文件流获取和文件字节读取功能
从以下版本开始:
2024/2/28 12:22
作者:
AaronFung
  • 构造器详细资料

    • SohelpFileDownloadService

      public SohelpFileDownloadService()
  • 方法详细资料

    • getFileStream

      @Comment("\u83b7\u53d6\u6587\u4ef6\u6d41") public InputStream getFileStream(String moduleName, String fileName) throws BusiException
      根据模块名和文件名获取文件输入流
      参数:
      moduleName - 模块名称,用于构建文件存储路径
      fileName - 文件名称,要读取的具体文件名
      返回:
      InputStream 文件输入流对象
      抛出:
      BusiException - 当文件不存在或无法访问时抛出业务异常
    • readBytes

      @Comment("\u8bfb\u53d6\u6587\u4ef6\u5b57\u8282") public byte[] readBytes(String moduleName, String fileName) throws BusiException
      读取指定模块下文件的全部字节内容
      参数:
      moduleName - 模块名称,用于定位文件存储位置
      fileName - 文件名称,要读取的具体文件名
      返回:
      byte[] 文件的字节数组内容
      抛出:
      BusiException - 当文件读取失败时抛出业务异常