public static void convertClass(Configuration configuration, ClassDoc cd, String outputdir) {
        if (cd == null || outputdir == null) {
            return;
        }
        try {
            SourcePosition sp = cd.position();
            if (sp == null)
                return;
            Reader r;
            // temp hack until we can update SourcePosition API.
            if (sp instanceof com.sun.tools.javadoc.SourcePositionImpl) {
                FileObject fo = ((com.sun.tools.javadoc.SourcePositionImpl) sp).fileObject();
                if (fo == null)
                    return;
                r = fo.openReader(true);
            } else {
                File file = sp.file();
                if (file == null)
                    return;
                r = new FileReader(file);
            }
            LineNumberReader reader = new LineNumberReader(r);
            int lineno = 1;
            String line;
            StringBuffer output = new StringBuffer();
            try {
                while ((line = reader.readLine()) != null) {
                    output.append(formatLine(line, configuration.sourcetab, lineno));
                    lineno++;
                }
            } finally {
                reader.close();
            }
            output = addLineNumbers(output.toString());
            output.insert(0, getHeader());
            output.append(getFooter());
            writeToFile(output.toString(), outputdir, cd.name(), configuration);
        } catch (Exception e){
            e.printStackTrace();
        }
    }