1 package net.sf.jpkgmk;
2
3 import java.io.File;
4 import java.io.IOException;
5 import java.io.Writer;
6
7 /**
8 * Manages the creation and deletion of a single file
9 * @author gommma (gommma AT users.sourceforge.net)
10 * @author Last changed by: $Author: gommma $
11 * @version $Revision: 2 $ $Date: 2008-08-20 21:14:19 +0200 (Mi, 20 Aug 2008) $
12 * @since 1.0
13 */
14 public interface FileHandler
15 {
16
17 /**
18 * Removes the file that can be retrieved via {@link #getFile()}
19 */
20 public void clean();
21
22 /**
23 * Creates the file that can be retrieved via {@link #getFile()}
24 * @param contentWriter
25 * @throws IOException
26 */
27 public void create(ContentWriter contentWriter) throws IOException;
28
29 /**
30 * @return The file to be created
31 */
32 public File getFile();
33
34
35 /**
36 * Is responsible to write the content into a file
37 */
38 public static interface ContentWriter
39 {
40 public void writeContent(Writer writer) throws IOException;
41 }
42
43 }