Loads an array of JSON objects from the data folder or a URL, and returns a JSONArray . Per standard JSON syntax, the array must be enclosed in a pair of hard brackets [] , and each object within the array must be separated by a comma. All files loaded and saved by the Proce
(String filename)
| 5483 | * @see PApplet#saveJSONArray(JSONArray, String) |
| 5484 | */ |
| 5485 | public JSONArray loadJSONArray(String filename) { |
| 5486 | // can't pass of createReader() to the constructor b/c of resource leak |
| 5487 | BufferedReader reader = createReader(filename); |
| 5488 | if (reader != null) { |
| 5489 | JSONArray outgoing = new JSONArray(reader); |
| 5490 | try { |
| 5491 | reader.close(); |
| 5492 | } catch (IOException e) { // not sure what would cause this |
| 5493 | e.printStackTrace(); |
| 5494 | } |
| 5495 | return outgoing; |
| 5496 | } |
| 5497 | return null; |
| 5498 | } |
| 5499 | |
| 5500 | |
| 5501 | static public JSONArray loadJSONArray(File file) { |
no test coverage detected