@Override
public void download(HttpServletResponse response, Long id) {
//获取文件信息
BaseFile baseFile = this.getFile(id);
if (baseFile == null) {
throw new PtException(BusinessMsgConstant.base.NO_DATA_EXIST);
}
try {
//配置返回头
response.setHeader("Content-Disposition",
"attachment;filename*=utf-8'zh_cn'" +
URLEncoder.encode(baseFile.getFileName(), "UTF-8"));
//下载文件,这里会调用minio获取文件流放入response的outputStream中
minioUtil.download(response, baseFile.getFileUrl(), baseFile.getBucketName());
} catch (Exception e) {
throw new PtException(BusinessMsgConstant.base.BUSINESS_EXCEPTION, e);
}
}
服务提供了这个方法,我需要调用这个方法获取文件并转换成字符串,有没有什么好的办法