MCPcopy Index your code
hub / github.com/MCBans/MCBans / write

Method write

src/main/java/com/mcbans/plugin/org/json/JSONArray.java:896–922  ·  view source on GitHub ↗

Write the contents of the JSONArray as JSON text to a writer. For compactness, no whitespace is added. Warning: This method assumes that the data structure is acyclical. @return The writer. @throws JSONException

(Writer writer)

Source from the content-addressed store, hash-verified

894 * @throws JSONException
895 */
896 public Writer write(Writer writer) throws JSONException {
897 try {
898 boolean b = false;
899 int len = length();
900
901 writer.write('[');
902
903 for (int i = 0; i < len; i += 1) {
904 if (b) {
905 writer.write(',');
906 }
907 Object v = this.myArrayList.get(i);
908 if (v instanceof JSONObject) {
909 ((JSONObject)v).write(writer);
910 } else if (v instanceof JSONArray) {
911 ((JSONArray)v).write(writer);
912 } else {
913 writer.write(JSONObject.valueToString(v));
914 }
915 b = true;
916 }
917 writer.write(']');
918 return writer;
919 } catch (IOException e) {
920 throw new JSONException(e);
921 }
922 }
923}

Callers 7

request_from_apiMethod · 0.45
appendMethod · 0.45
endMethod · 0.45
keyMethod · 0.45
bansMethod · 0.45
extractResourceMethod · 0.45

Calls 3

lengthMethod · 0.95
valueToStringMethod · 0.95
getMethod · 0.45

Tested by

no test coverage detected