(Writer writer, Object value,
int indentFactor, int indent)
| 1820 | |
| 1821 | |
| 1822 | static final Writer writeValue(Writer writer, Object value, |
| 1823 | int indentFactor, int indent) throws IOException { |
| 1824 | if (value == null || value.equals(null)) { |
| 1825 | writer.write("null"); |
| 1826 | } else if (value instanceof JSONObject) { |
| 1827 | ((JSONObject) value).writeInternal(writer, indentFactor, indent); |
| 1828 | } else if (value instanceof JSONArray) { |
| 1829 | ((JSONArray) value).writeInternal(writer, indentFactor, indent); |
| 1830 | } else if (value instanceof Map) { |
| 1831 | new JSONObject(value).writeInternal(writer, indentFactor, indent); |
| 1832 | } else if (value instanceof Collection) { |
| 1833 | new JSONArray(value).writeInternal(writer, indentFactor, |
| 1834 | indent); |
| 1835 | } else if (value.getClass().isArray()) { |
| 1836 | new JSONArray(value).writeInternal(writer, indentFactor, indent); |
| 1837 | } else if (value instanceof Number) { |
| 1838 | writer.write(numberToString((Number) value)); |
| 1839 | } else if (value instanceof Boolean) { |
| 1840 | writer.write(value.toString()); |
| 1841 | /* |
| 1842 | } else if (value instanceof JSONString) { |
| 1843 | Object o; |
| 1844 | try { |
| 1845 | o = ((JSONString) value).toJSONString(); |
| 1846 | } catch (Exception e) { |
| 1847 | throw new RuntimeException(e); |
| 1848 | } |
| 1849 | writer.write(o != null ? o.toString() : quote(value.toString())); |
| 1850 | */ |
| 1851 | } else { |
| 1852 | quote(value.toString(), writer); |
| 1853 | } |
| 1854 | return writer; |
| 1855 | } |
| 1856 | |
| 1857 | |
| 1858 | static final void indent(Writer writer, int indent) throws IOException { |
no test coverage detected