| 44 | |
| 45 | //写入json文件 |
| 46 | public static boolean createJsonFile(String jsonString, String filePath, String fileName) { |
| 47 | boolean flag = true; |
| 48 | |
| 49 | Map2Json map2Json = new Map2Json(); |
| 50 | int i = map2Json.getI(); |
| 51 | //System.out.println(i); |
| 52 | |
| 53 | |
| 54 | String fullPath = filePath + File.separator + fileName+ i + ".json"; |
| 55 | i++; |
| 56 | //System.out.println(i); |
| 57 | map2Json.setI(i); |
| 58 | |
| 59 | try{ |
| 60 | File file = new File(fullPath); |
| 61 | if(!file.exists()); |
| 62 | file.createNewFile(); |
| 63 | |
| 64 | Writer write = new OutputStreamWriter(new FileOutputStream(file),"UTF-8"); |
| 65 | write.write(jsonString); |
| 66 | |
| 67 | write.flush(); |
| 68 | write.close(); |
| 69 | |
| 70 | }catch (Exception e){ |
| 71 | flag = false; |
| 72 | e.printStackTrace(); |
| 73 | } |
| 74 | return flag; |
| 75 | } |
| 76 | |
| 77 | public static boolean createJsonFile1(String jsonString, String filePath, String fileName) { |
| 78 | boolean flag = true; |