Java Code Examples for jodd.io.FileUtil#readString()
The following examples show how to use
jodd.io.FileUtil#readString() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MenuDaoTest.java From DAFramework with MIT License | 5 votes |
@Test public void insertAll() { try { String json = FileUtil.readString("../../WdtcWeb/static/data/allMenus.json", "utf-8"); ActionResultList<EMenu> allMenus = WJsonUtils.toObject(json, ActionResultList.class, EMenu.class); Assert.notNull(allMenus, ""); Assert.notNull(allMenus.getData(), ""); int index = 10; for (EMenu menu : allMenus.getData()) { if (menu.getItems() != null && menu.getItems().size() > 0) { printMenuInsertSql(index + "", "0", menu.getName(), menu.getCode(), 10, "message"); int subIndex1 = 10; for (EMenu subMenu1 : menu.getItems()) { if (subMenu1.getItems() != null && subMenu1.getItems().size() > 0) { printMenuInsertSql(index + "" + subIndex1, index + "", subMenu1.getName(), subMenu1.getCode(), 20, "message"); int subIndex2 = 10; for (EMenu subMenu2 : subMenu1.getItems()) { printMenuInsertSql(index + "" + subIndex1 + "" + subIndex2, index + "" + subIndex1, subMenu2.getName(), subMenu2.getCode(), 1, "message"); subIndex2 += 10; } } else { printMenuInsertSql(index + "" + subIndex1, index + "", subMenu1.getName(), subMenu1.getCode(), 20, "message"); } subIndex1 += 10; } } else { printMenuInsertSql(index + "", "0", menu.getName(), menu.getCode(), 1, "message"); } index += 10; } } catch (IOException e) { LOG.error(e.getMessage(), e); } }
Example 2
Source File: EsDataHelper.java From wES with MIT License | 5 votes |
/** * 重建Index * * @param index */ public void reCreateIndex(String index, String type, String backupDir) { try { String path = path(backupDir, index, type + ".json"); String json = FileUtil.readString(path, "utf-8"); if (json != null && json.trim().length() > 0) { rmAllData(index, type); putMapping(index, type, WJsonUtils.fromJson(json, Object.class)); } } catch (Exception e) { LOG.error(e.getMessage(), e); } }