From 471f693ac87a6ed6a2b00e93472b025266c0271f Mon Sep 17 00:00:00 2001
From: jinpengyong <jpy123456>
Date: Mon, 13 Nov 2023 09:27:19 +0800
Subject: [PATCH] Merge branch 'wb' of http://blit.7drlb.com:8888/r/moral into qa
---
screen-api/src/main/java/com/moral/api/utils/JsonUtil.java | 24 ++++++++++++++++++++----
1 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/screen-api/src/main/java/com/moral/api/utils/JsonUtil.java b/screen-api/src/main/java/com/moral/api/utils/JsonUtil.java
index 6cf2b65..7ec0dec 100644
--- a/screen-api/src/main/java/com/moral/api/utils/JsonUtil.java
+++ b/screen-api/src/main/java/com/moral/api/utils/JsonUtil.java
@@ -1,9 +1,9 @@
package com.moral.api.utils;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.core.io.Resource;
+
+import java.io.*;
public class JsonUtil {
@@ -31,5 +31,21 @@
}
}
+ public static String testReadFile(String filePath) throws IOException {
+// ClassPathResource classPathResource = new ClassPathResource("resource.properties");
+ String jsonStr = "";
+ Resource resource = new ClassPathResource(filePath);
+ InputStream is = resource.getInputStream();
+ Reader reader = new InputStreamReader(resource.getInputStream(), "utf-8");
+ int ch = 0;
+ StringBuffer sb = new StringBuffer();
+ while ((ch = reader.read()) != -1) {
+ sb.append((char) ch);
+ }
+ reader.close();
+ jsonStr = sb.toString();
+ return jsonStr;
+ }
+
}
--
Gitblit v1.8.0