MCPcopy Create free account
hub / github.com/MCBans/MCBans / key

Method key

src/main/java/com/mcbans/plugin/org/json/JSONWriter.java:201–221  ·  view source on GitHub ↗

Append a key. The key will be associated with the next value. In an object, every value must be preceded by a key. @param string A key string. @return this @throws JSONException If the key is out of place. For example, keys do not belong in arrays or if the key is null.

(String string)

Source from the content-addressed store, hash-verified

199 * do not belong in arrays or if the key is null.
200 */
201 public JSONWriter key(String string) throws JSONException {
202 if (string == null) {
203 throw new JSONException("Null key.");
204 }
205 if (this.mode == 'k') {
206 try {
207 stack[top - 1].putOnce(string, Boolean.TRUE);
208 if (this.comma) {
209 this.writer.write(',');
210 }
211 this.writer.write(JSONObject.quote(string));
212 this.writer.write(':');
213 this.comma = false;
214 this.mode = 'o';
215 return this;
216 } catch (IOException e) {
217 throw new JSONException(e);
218 }
219 }
220 throw new JSONException("Misplaced key.");
221 }
222
223
224 /**

Callers

nothing calls this directly

Calls 3

quoteMethod · 0.95
putOnceMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected