MCPcopy Index your code
hub / github.com/benfry/processing4 / loadJSONObject

Method loadJSONObject

core/src/processing/core/PApplet.java:5367–5380  ·  view source on GitHub ↗

Loads a JSON from the data folder or a URL, and returns a JSONObject . All files loaded and saved by the Processing API use UTF-8 encoding. @webref input:files @webBrief Loads a JSON from the data folder or a URL, and returns a JSONObject @param filename

(String filename)

Source from the content-addressed store, hash-verified

5365 * @see PApplet#saveJSONArray(JSONArray, String)
5366 */
5367 public JSONObject loadJSONObject(String filename) {
5368 // can't pass of createReader() to the constructor b/c of resource leak
5369 BufferedReader reader = createReader(filename);
5370 if (reader != null) {
5371 JSONObject outgoing = new JSONObject(reader);
5372 try {
5373 reader.close();
5374 } catch (IOException e) { // not sure what would cause this
5375 e.printStackTrace();
5376 }
5377 return outgoing;
5378 }
5379 return null;
5380 }
5381
5382
5383 /**

Callers

nothing calls this directly

Calls 3

createReaderMethod · 0.95
closeMethod · 0.45
printStackTraceMethod · 0.45

Tested by

no test coverage detected