|
|
|
@ -1,12 +1,6 @@
|
|
|
|
|
package com.ruoyi.common.utils.file;
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.io.FileInputStream;
|
|
|
|
|
import java.io.FileNotFoundException;
|
|
|
|
|
import java.io.FileOutputStream;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.io.OutputStream;
|
|
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
|
|
import java.io.*;
|
|
|
|
|
import java.net.URLEncoder;
|
|
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
|
|
import java.util.Base64;
|
|
|
|
@ -345,4 +339,31 @@ public class FileUtils
|
|
|
|
|
throw new ServiceException("Base64转图片错误,message is " + e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 读取json文件
|
|
|
|
|
*
|
|
|
|
|
* @param Filename 文件名
|
|
|
|
|
* @return {@code String}
|
|
|
|
|
*/
|
|
|
|
|
public static String readJsonFile(String Filename) {
|
|
|
|
|
String jsonStr = "";
|
|
|
|
|
try {
|
|
|
|
|
File jsonFile = new File(Filename);
|
|
|
|
|
FileReader fileReader = new FileReader(jsonFile);
|
|
|
|
|
Reader reader = new InputStreamReader(new FileInputStream(jsonFile), StandardCharsets.UTF_8);
|
|
|
|
|
int ch;
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
while ((ch = reader.read()) != -1) {
|
|
|
|
|
sb.append((char) ch);
|
|
|
|
|
}
|
|
|
|
|
fileReader.close();
|
|
|
|
|
reader.close();
|
|
|
|
|
jsonStr = sb.toString();
|
|
|
|
|
return jsonStr;
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|