赞
踩
- //json转String
- public static String json2String(String path) throws IOException {
- StringBuilder result = new StringBuilder();
- InputStream in = new FileInputStream(path);
- //读取文件上的数据。
- // 将字节流向字符流的转换。
- InputStreamReader isr = new InputStreamReader(in,"UTF-8");//读取
- //创建字符流缓冲区
- BufferedReader bufr = new BufferedReader(isr);//缓冲
-
- String line = null;
- while ((line = bufr.readLine()) != null) {
- result.append(System.lineSeparator()+line);
- }
- isr.close();
- return result.toString();
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。