File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
src/com/bwyap/utility/resource Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,29 @@ public static JSONObject loadJSON(File file) {
55
55
}
56
56
57
57
58
+ /**
59
+ * Loads a JSON object from an internal file.
60
+ * @param path the internal path of the JSON file
61
+ * @return
62
+ */
63
+ public static JSONObject loadInternalJSON (String path ) {
64
+ JSONObject jsonObject = null ;
65
+
66
+ JSONParser parser = new JSONParser ();
67
+ try {
68
+ String config = loadInternalTextFileAsString (path );
69
+ Object o = parser .parse (config );
70
+ jsonObject = (JSONObject ) o ;
71
+ }
72
+ catch (ParseException e ) {
73
+ log ("An error occurred while trying to parse internal JSON file <" + path + ">." );
74
+ printStackTrace (e );
75
+ }
76
+
77
+ return jsonObject ;
78
+ }
79
+
80
+
58
81
/**
59
82
* Reads an internal CSV file from within the jar and loads the data into a hash map.
60
83
* @param path
You can’t perform that action at this time.
0 commit comments