MCPcopy Create free account
hub / github.com/cschanck/single-file-java / print

Method print

src/main/java/org/sfj/JSONOne.java:524–551  ·  view source on GitHub ↗
(Writer w, int indent, boolean compact)

Source from the content-addressed store, hash-verified

522 }
523
524 @Override
525 public void print(Writer w, int indent, boolean compact) throws IOException {
526 String ind = AbstractJSONObject.indent(indent);
527 w.append('{');
528 boolean first = true;
529 String ind2 = AbstractJSONObject.indent(indent + 1);
530 for (Entry<String, JObject> obj : this.entrySet()) {
531 if (first) {
532 first = false;
533 } else {
534 w.append(',');
535 }
536 if (!compact) {
537 w.append(System.lineSeparator());
538 w.append(ind2);
539 }
540 w.append('"');
541 w.append(obj.getKey());
542 w.append('"');
543 w.append(compact ? ":" : " : ");
544 obj.getValue().print(w, indent + 1, compact);
545 }
546 if (!compact) {
547 w.append(System.lineSeparator());
548 w.append(ind);
549 }
550 w.append('}');
551 }
552
553 }
554

Callers

nothing calls this directly

Calls 5

indentMethod · 0.95
entrySetMethod · 0.95
appendMethod · 0.65
printMethod · 0.65
getKeyMethod · 0.45

Tested by

no test coverage detected