1 20 package net.sf.clirr.core; 21 22 import java.io.FileNotFoundException ; 23 import java.io.FileOutputStream ; 24 import java.io.OutputStream ; 25 import java.io.PrintStream ; 26 27 33 abstract class FileDiffListener extends DiffListenerAdapter 34 { 35 private PrintStream outputStream; 36 37 42 FileDiffListener(String outFile) throws FileNotFoundException 43 { 44 if (outFile == null) 45 { 46 outputStream = System.out; 47 } 48 else 49 { 50 final OutputStream out = new FileOutputStream (outFile); 51 outputStream = new PrintStream (out); 52 } 53 54 } 55 56 60 protected final PrintStream getOutputStream() 61 { 62 return outputStream; 63 } 64 65 66 72 public final void stop() 73 { 74 writeFooter(); 75 76 if (outputStream != System.out) 77 { 78 outputStream.close(); 79 } 80 super.stop(); 81 } 82 83 90 protected void writeFooter() 91 { 92 } 93 } 94 | Popular Tags |