protected static char[] getCharContent(JavaFileObject fileObject) throws IOException {
        CharSequence cs = fileObject.getCharContent(true);
        if (cs instanceof CharBuffer) {
            return JavacFileManager.toArray((CharBuffer)cs);
        } else {
            return cs.toString().toCharArray();
        }
    }