KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > io > TCFileImpl


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.io;
5
6 import org.apache.commons.io.FileUtils;
7
8 import java.io.File JavaDoc;
9 import java.io.IOException JavaDoc;
10
11 public class TCFileImpl implements TCFile {
12   private File JavaDoc pathToFile;
13   
14   public TCFileImpl(File JavaDoc pathToFile) {
15     this.pathToFile = pathToFile;
16   }
17   
18   public TCFileImpl(TCFile location, String JavaDoc fileName) {
19     pathToFile = new File JavaDoc(location.getFile(), fileName);
20   }
21
22   public boolean exists() {
23     return pathToFile.exists();
24   }
25
26   public void forceMkdir() throws IOException JavaDoc {
27     FileUtils.forceMkdir(pathToFile);
28   }
29
30   public boolean createNewFile() throws IOException JavaDoc {
31     return pathToFile.createNewFile();
32   }
33
34   public File JavaDoc getFile() {
35     return pathToFile;
36   }
37
38   public TCFile createNewTCFile(TCFile location, String JavaDoc fileName) {
39     return new TCFileImpl(location, fileName);
40   }
41
42   public String JavaDoc toString() {
43     return pathToFile.toString();
44   }
45 }
46
Popular Tags