View Javadoc
1 package net.sourceforge.pmd.cpd; 2 3 import java.io.BufferedWriter; 4 import java.io.File; 5 import java.io.FileWriter; 6 import java.io.IOException; 7 import java.io.Writer; 8 9 /*** 10 * @author Philippe T'Seyen 11 */ 12 public class FileReporter 13 { 14 private File reportFile; 15 16 public FileReporter(File reportFile) { 17 if (reportFile == null) throw new NullPointerException("reportFile can not be null"); 18 this.reportFile = reportFile; 19 } 20 21 public void report(String content) throws ReportException { 22 try { 23 Writer writer = null; 24 try { 25 writer = new BufferedWriter(new FileWriter(reportFile)); 26 writer.write(content); 27 } finally { 28 if (writer != null) writer.close(); 29 } 30 } catch (IOException ioe) { 31 throw new ReportException(ioe); 32 } 33 } 34 }

This page was automatically generated by Maven