|
@@ -22,6 +22,8 @@ import java.nio.file.Files;
|
|
|
import java.nio.file.Paths;
|
|
|
import java.util.Map;
|
|
|
|
|
|
+import static cn.hutool.core.io.FileUtil.getAbsolutePath;
|
|
|
+
|
|
|
/**
|
|
|
* 客户端工具类
|
|
|
*
|
|
@@ -72,9 +74,9 @@ public class ServletUtils {
|
|
|
* @param reqRange range
|
|
|
* @param response 响应体
|
|
|
*/
|
|
|
- public static void transfer(byte[] content, String reqRange, HttpServletResponse response){
|
|
|
+ public static void transfer(byte[] content, String reqRange, HttpServletResponse response,String path){
|
|
|
try {
|
|
|
- File sf = fileTransition(content);
|
|
|
+ File sf = fileTransition(content,path);
|
|
|
log.info("=====file文件:{}",sf);
|
|
|
RspInfo ri= getPartFileRsp( sf, reqRange) ;
|
|
|
response.setContentLength((int)ri.content_Length);
|
|
@@ -154,8 +156,8 @@ public class ServletUtils {
|
|
|
* @return file
|
|
|
* @throws IOException 异常
|
|
|
*/
|
|
|
- public static File fileTransition(byte[] content) throws IOException{
|
|
|
- File file = new File("data/file/videoTest.mp4");
|
|
|
+ public static File fileTransition(byte[] content,String path) throws IOException{
|
|
|
+ File file = new File(getAbsolutePath(path));
|
|
|
log.info("======file:{}",file);
|
|
|
if(!file.exists()){
|
|
|
boolean newFile = file.createNewFile();
|