KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > pmd > renderers > EmacsRenderer


1 /**
2  * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3  */

4 package net.sourceforge.pmd.renderers;
5
6 import net.sourceforge.pmd.IRuleViolation;
7 import net.sourceforge.pmd.Report;
8
9 import java.io.IOException JavaDoc;
10 import java.io.Writer JavaDoc;
11 import java.util.Iterator JavaDoc;
12
13 public class EmacsRenderer extends AbstractRenderer {
14
15     protected static final String JavaDoc EOL = System.getProperty("line.separator", "\n");
16
17     public void render(Writer JavaDoc writer, Report report) throws IOException JavaDoc {
18         StringBuffer JavaDoc buf = new StringBuffer JavaDoc();
19         for (Iterator JavaDoc i = report.iterator(); i.hasNext();) {
20             IRuleViolation rv = (IRuleViolation) i.next();
21             buf.setLength(0);
22             buf.append(EOL).append(rv.getFilename());
23             buf.append(':').append(Integer.toString(rv.getBeginLine()));
24             buf.append(": ").append(rv.getDescription());
25             writer.write(buf.toString());
26         }
27     }
28 }
29
Popular Tags