yshop1.9,新增城市接口,修复小程序登陆与支付问题,发布mpvue1.0小程序
This commit is contained in:
@ -114,7 +114,7 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
|
||||
/**
|
||||
* inputStream 转 File
|
||||
*/
|
||||
static File inputStreamToFile(InputStream ins, String name) throws Exception{
|
||||
public static File inputStreamToFile(InputStream ins, String name) throws Exception{
|
||||
File file = new File(System.getProperty("java.io.tmpdir") + File.separator + name);
|
||||
if (file.exists()) {
|
||||
return file;
|
||||
@ -310,4 +310,31 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
|
||||
return getMd5(getByte(file));
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取json文件,返回json串
|
||||
* @param fileName
|
||||
* @return
|
||||
*/
|
||||
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),"utf-8");
|
||||
int ch = 0;
|
||||
StringBuffer sb = new StringBuffer();
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user