(Writer writer, Object value,
int indentFactor, int indent)
| 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 { |
no test coverage detected