Method
createJsonFile1
(String jsonString, String filePath, String fileName)
Source from the content-addressed store, hash-verified
| 75 | } |
| 76 | |
| 77 | public static boolean createJsonFile1(String jsonString, String filePath, String fileName) { |
| 78 | boolean flag = true; |
| 79 | |
| 80 | Map2Json map2Json = new Map2Json(); |
| 81 | |
| 82 | |
| 83 | String fullPath = filePath + File.separator + fileName + ".json"; |
| 84 | |
| 85 | |
| 86 | try{ |
| 87 | File file = new File(fullPath); |
| 88 | if(!file.exists()); |
| 89 | file.createNewFile(); |
| 90 | |
| 91 | Writer write = new OutputStreamWriter(new FileOutputStream(file),"UTF-8"); |
| 92 | write.write(jsonString); |
| 93 | |
| 94 | write.flush(); |
| 95 | write.close(); |
| 96 | |
| 97 | }catch (Exception e){ |
| 98 | flag = false; |
| 99 | e.printStackTrace(); |
| 100 | } |
| 101 | return flag; |
| 102 | } |
| 103 | } |