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/FileConvertTool.java | 56 +++----------------------------------------------------- 1 files changed, 3 insertions(+), 53 deletions(-) diff --git a/src/main/java/com/hx/util/FileConvertTool.java b/src/main/java/com/hx/util/FileConvertTool.java index 55c93c2..a57a0fd 100644 --- a/src/main/java/com/hx/util/FileConvertTool.java +++ b/src/main/java/com/hx/util/FileConvertTool.java @@ -6,6 +6,7 @@ import org.springframework.http.MediaType; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.commons.CommonsMultipartFile; +import sun.misc.BASE64Decoder; import java.io.*; import java.net.URL; @@ -184,59 +185,6 @@ } /** - * 鏍规嵁byte鏁扮粍锛岀敓鎴愭枃浠� - */ - public static File getFile(String baseIn, String filePath, String fileName) { - if(baseIn == null){ - return null; - } - - BufferedOutputStream bos = null; - FileOutputStream fos = null; - File file = null; - try { - InputStream in = parse_inputStream(baseIn); - if(in == null){ - return null; - } - File dir = new File(filePath); - //鍒ゆ柇鏂囦欢鐩綍鏄惁瀛樺湪 - if(!dir.exists()){ - dir.mkdirs(); - } - file = new File(filePath+"/"+fileName); - fos = new FileOutputStream(file); - byte[] b = new byte[BUFFER_SIZE]; -// while ((in.read(b)) != -1) { -// fos.write(b); // 鍐欏叆鏁版嵁 -// } - int len; - while ((len = in.read(b)) != -1){ - fos.write(b, 0, len); - } - in.close(); - } catch (Exception e) { - e.printStackTrace(); - } finally { - if (bos != null) { - try { - bos.close(); - } catch (IOException e1) { - e1.printStackTrace(); - } - } - if (fos != null) { - try { - fos.close(); - } catch (IOException e1) { - e1.printStackTrace(); - } - } - } - return file; - } - - /** * 鑾峰緱鎸囧畾鏂囦欢鐨刡yte鏁扮粍 */ private static byte[] getBytes(String filePath){ @@ -350,4 +298,6 @@ return false; } } + + } -- Gitblit v1.8.0