接口 FileStorageService

所有已知实现类:
AliyunOssFileStorageServiceImpl, LocalFileStorageServiceImpl

public interface FileStorageService
文件操作接口
版本:
: v2.0
作者:
: uu
  • 方法详细资料

    • buildAccessUrl

      default String buildAccessUrl(String fileUid, String ext)
      构建访问地址
      参数:
      fileUid - 文件UUID
      ext - 文件扩展名
      返回:
      访问地址
    • save

      FileRecord save(org.springframework.web.multipart.MultipartFile file) throws Exception
      上传文件
      参数:
      file -
      返回:
      抛出:
      Exception
    • save

      FileRecord save(InputStream inputStream, String fileName, long size) throws Exception
      上传文件
      参数:
      inputStream -
      fileName -
      size -
      返回:
      抛出:
      Exception
    • save

      default FileRecord save(String diskFilePath, String fileName) throws Exception
      上传文件
      参数:
      diskFilePath - 磁盘中已存在的临时文件
      fileName - 文件名
      返回:
      抛出:
      Exception
    • getFile

      InputStream getFile(String filePath) throws Exception
      获取文件
      参数:
      filePath - 文件路径
      返回:
      抛出:
      Exception
    • download

      void download(FileRecord uploadFile, jakarta.servlet.http.HttpServletResponse response) throws Exception
      获取文件
      参数:
      uploadFile -
      response -
      抛出:
      Exception
    • delete

      boolean delete(String filePath)
      删除文件
      参数:
      filePath - 文件路径
      返回:
      是否删除成功