From 2aad5c6ca552423d1b8e6e8c869a698a15822759 Mon Sep 17 00:00:00 2001 From: fhx <308050795@qq.com> Date: 星期二, 25 四月 2023 15:32:39 +0800 Subject: [PATCH] 1.修改redis工具 --- src/main/java/com/hx/util/FileUtil.java | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/hx/util/FileUtil.java b/src/main/java/com/hx/util/FileUtil.java index 03e7fee..69a7d41 100644 --- a/src/main/java/com/hx/util/FileUtil.java +++ b/src/main/java/com/hx/util/FileUtil.java @@ -1,6 +1,9 @@ package com.hx.util; +import org.apache.commons.io.FileUtils; + import java.io.*; +import java.net.URL; /** * 鏂囦欢璇诲彇宸ュ叿绫� @@ -10,6 +13,23 @@ public class FileUtil { /** + * @param pathUrl 缃戠粶璺緞 + * @return 鏂囦欢 + */ + public static File getUrlFile(String pathUrl){ + File temp = null; + try{ + URL url = new URL(pathUrl); + temp = File.createTempFile("temp", ".xls"); + FileUtils.copyURLToFile(url, temp); + temp.deleteOnExit(); + }catch (Exception e){ + throw new RuntimeException("閫氳繃URL鑾峰彇鏂囦欢鍑洪敊",e); + } + return temp; + } + + /** * 璇诲彇鏂囦欢鍐呭锛屼綔涓哄瓧绗︿覆杩斿洖 */ public static String readFileAsString(String filePath) throws IOException { -- Gitblit v1.8.0