KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com4j > tlbimp > DumpCodeWriter


1 package com4j.tlbimp;
2
3 import java.io.File JavaDoc;
4 import java.io.FilterWriter JavaDoc;
5 import java.io.IOException JavaDoc;
6 import java.io.OutputStreamWriter JavaDoc;
7
8 /**
9  * {@link CodeWriter} that dumps to stdout. For debugging.
10  *
11  * @author Kohsuke Kawaguchi (kk@kohsuke.org)
12  */

13 public class DumpCodeWriter implements CodeWriter {
14     public IndentingWriter create(File JavaDoc file) {
15         IndentingWriter w = new IndentingWriter(new FilterWriter JavaDoc(new OutputStreamWriter JavaDoc(System.out)) {
16             public void close() throws IOException JavaDoc {
17                 flush();
18                 // don't close ignore
19
}
20         }, true);
21         w.printf("------ %1s ---------\n",file.getPath());
22         return w;
23     }
24 }
25
Popular Tags