public Writer writeList(Object o) throws IOException {
        if (o == null) {
            writeNull();
            return this;
        }
        if (o.getClass().isArray()) {
            return writeList(Arrays.asList(o));
        }
        Collection c = (Collection) o;
        writeIterator(c.size(), c.iterator());
        return this;
    }