public void cdsect(String data) throws IOException {
        check(false);
        // BEGIN android-changed: ]]> is not allowed within a CDATA,
        // so break and start a new one when necessary.
        data = data.replace("]]>", "]]]]><![CDATA[>");
        char[] chars = data.toCharArray();
        // We also aren't allowed any invalid characters.
        for (char ch : chars) {
            boolean valid = (ch >= 0x20 && ch <= 0xd7ff) ||
                    (ch == '\t' || ch == '\n' || ch == '\r') ||
                    (ch >= 0xe000 && ch <= 0xfffd);
            if (!valid) {
                reportInvalidCharacter(ch);
            }
        }
        writer.write("<![CDATA[");
        writer.write(chars, 0, chars.length);
        writer.write("]]>");
        // END android-changed
    }