MCPcopy Index your code
hub / github.com/processing/processing / writeValue

Method writeValue

core/src/processing/data/JSONObject.java:1768–1801  ·  view source on GitHub ↗
(Writer writer, Object value,
                                 int indentFactor, int indent)

Source from the content-addressed store, hash-verified

1766
1767
1768 static final Writer writeValue(Writer writer, Object value,
1769 int indentFactor, int indent) throws IOException {
1770 if (value == null || value.equals(null)) {
1771 writer.write("null");
1772 } else if (value instanceof JSONObject) {
1773 ((JSONObject) value).writeInternal(writer, indentFactor, indent);
1774 } else if (value instanceof JSONArray) {
1775 ((JSONArray) value).writeInternal(writer, indentFactor, indent);
1776 } else if (value instanceof Map) {
1777 new JSONObject(value).writeInternal(writer, indentFactor, indent);
1778 } else if (value instanceof Collection) {
1779 new JSONArray(value).writeInternal(writer, indentFactor,
1780 indent);
1781 } else if (value.getClass().isArray()) {
1782 new JSONArray(value).writeInternal(writer, indentFactor, indent);
1783 } else if (value instanceof Number) {
1784 writer.write(numberToString((Number) value));
1785 } else if (value instanceof Boolean) {
1786 writer.write(value.toString());
1787 /*
1788 } else if (value instanceof JSONString) {
1789 Object o;
1790 try {
1791 o = ((JSONString) value).toJSONString();
1792 } catch (Exception e) {
1793 throw new RuntimeException(e);
1794 }
1795 writer.write(o != null ? o.toString() : quote(value.toString()));
1796 */
1797 } else {
1798 quote(value.toString(), writer);
1799 }
1800 return writer;
1801 }
1802
1803
1804 static final void indent(Writer writer, int indent) throws IOException {

Callers 2

writeInternalMethod · 0.95
writeInternalMethod · 0.95

Calls 6

numberToStringMethod · 0.95
quoteMethod · 0.95
writeMethod · 0.65
equalsMethod · 0.45
writeInternalMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected