public XmlSerializer endTag(String namespace, String name)
            throws IOException {

        if (!pending) {
            depth--;
            //        if (namespace == null)
            //          namespace = "";
        }

        if ((namespace == null
                && elementStack[depth * 3] != null)
                || (namespace != null
                && !namespace.equals(elementStack[depth * 3]))
                || !elementStack[depth * 3 + 2].equals(name)) {
            throw new IllegalArgumentException("</{" + namespace + "}" + name + "> does not match start");
        }

        if (pending) {
            check(true);
            depth--;
        } else {
            if (indent[depth + 1]) {
                writer.write("\r\n");
                for (int i = 0; i < depth; i++) {
                    writer.write("  ");
                }
            }

            writer.write("</");
            String prefix = elementStack[depth * 3 + 1];
            if (StringUtils.isNotEmpty(prefix)) {
                writer.write(prefix);
                writer.write(':');
            }
            writer.write(name);
            writer.write('>');
        }

        nspCounts[depth + 1] = nspCounts[depth];
        return this;
    }
size (in characters) for the write buffer
main/thirdparty/cgeo/org/kxml2/io/KXmlSerializer.java