Skip to content

Commit da8ff52

Browse files
committed
update from lase
1 parent f54b2f1 commit da8ff52

21 files changed

+32
-34
lines changed

.gitignore_java

100644100755
File mode changed.

README.md

100644100755
File mode changed.

dependency/com.fasterxml.jackson.databind-2.10.0.LIFERAY-PATCHED-1.jar

100644100755
File mode changed.

dependency/commons-io-2.6.jar

100644100755
File mode changed.

dependency/gson-2.8.6.jar

100644100755
File mode changed.

dependency/jackson-core-2.10.3.jar

100644100755
File mode changed.

dependency/javax.annotation-api-1.3.2.jar

100644100755
File mode changed.

dependency/json-simple-1.1.1.jar

100644100755
File mode changed.

lib/utils/CSVUtil.java

100644100755
File mode changed.

lib/utils/CollectionUtil.java

100644100755
File mode changed.

lib/utils/DiffUtil.java

100644100755
File mode changed.

lib/utils/EclipseUtil.java

100644100755
File mode changed.

lib/utils/FileUtil.java

100644100755
File mode changed.

lib/utils/GitUtil.java

100644100755
File mode changed.

lib/utils/JSONUtil.java

100644100755
Lines changed: 32 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -13,39 +13,37 @@
1313

1414
public class JSONUtil {
1515

16-
public static JSONObject parseJSONFromFile(String jsonFpath) {
17-
FileReader reader;
18-
JSONObject object = null;
19-
try {
20-
reader = new FileReader(jsonFpath);
21-
JSONParser jsonParser = new JSONParser();
22-
23-
object = (JSONObject) jsonParser.parse(reader);
24-
} catch (IOException | ParseException e) {
25-
// TODO Auto-generated catch block
26-
e.printStackTrace();
27-
}
28-
29-
return object;
30-
31-
}
32-
33-
34-
public static void writeMapAsJson(Map<String, Integer> map, String jsonFilePath) {
35-
Map<String, String> newMap = new HashMap<String, String>();
36-
for (String key : map.keySet()) {
37-
newMap.put(key, String.valueOf(map.get(key)));
38-
}
39-
40-
ObjectMapper mapper = new ObjectMapper();
41-
String json = null;
42-
try {
43-
json = mapper.writeValueAsString(newMap);
44-
} catch (JsonProcessingException e) {
45-
e.printStackTrace();
46-
}
47-
FileUtil.writeStr2File(json, jsonFilePath);
48-
}
49-
16+
public static JSONObject parseJSONFromFile(String jsonFpath) {
17+
FileReader reader;
18+
JSONObject object = null;
19+
try {
20+
reader = new FileReader(jsonFpath);
21+
JSONParser jsonParser = new JSONParser();
22+
23+
object = (JSONObject) jsonParser.parse(reader);
24+
} catch (IOException | ParseException e) {
25+
// TODO Auto-generated catch block
26+
e.printStackTrace();
27+
}
28+
29+
return object;
30+
31+
}
32+
33+
public static void writeMapAsJson(Map<String, Integer> map, String jsonFilePath) {
34+
Map<String, String> newMap = new HashMap<String, String>();
35+
for (String key : map.keySet()) {
36+
newMap.put(key, String.valueOf(map.get(key)));
37+
}
38+
39+
ObjectMapper mapper = new ObjectMapper();
40+
String json = null;
41+
try {
42+
json = mapper.writeValueAsString(newMap);
43+
} catch (JsonProcessingException e) {
44+
e.printStackTrace();
45+
}
46+
FileUtil.writeStr2File(json, jsonFilePath);
47+
}
5048

5149
}

lib/utils/ObjectUtil.java

100644100755
File mode changed.

lib/utils/ProcessUtil.java

100644100755
File mode changed.

lib/utils/RandomUtil.java

100644100755
File mode changed.

lib/utils/SRCUtil.java

100644100755
File mode changed.

lib/utils/TimeUtil.java

100644100755
File mode changed.

lib/utils/XMLUtil.java

100644100755
File mode changed.

0 commit comments

Comments
 (0)