KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com4j > tlbimp > FileCodeWriter


1 package com4j.tlbimp;
2
3 import java.io.File JavaDoc;
4 import java.io.FileWriter JavaDoc;
5 import java.io.IOException JavaDoc;
6
7 /**
8  * @author Kohsuke Kawaguchi (kk@kohsuke.org)
9  */

10 public class FileCodeWriter implements CodeWriter {
11     private final File JavaDoc outDir;
12
13     public FileCodeWriter(File JavaDoc outDir) {
14         this.outDir = outDir;
15     }
16
17     public IndentingWriter create(File JavaDoc file) throws IOException JavaDoc {
18         file = new File JavaDoc(outDir,file.getPath());
19         file.getParentFile().mkdirs();
20         // TODO: proper escaping
21
return new IndentingWriter(new FileWriter JavaDoc(file));
22     }
23 }
24
Popular Tags