01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.io;
05:
06: import org.apache.commons.io.FileUtils;
07:
08: import java.io.File;
09: import java.io.IOException;
10:
11: public class TCFileImpl implements TCFile {
12: private File pathToFile;
13:
14: public TCFileImpl(File pathToFile) {
15: this .pathToFile = pathToFile;
16: }
17:
18: public TCFileImpl(TCFile location, String fileName) {
19: pathToFile = new File(location.getFile(), fileName);
20: }
21:
22: public boolean exists() {
23: return pathToFile.exists();
24: }
25:
26: public void forceMkdir() throws IOException {
27: FileUtils.forceMkdir(pathToFile);
28: }
29:
30: public boolean createNewFile() throws IOException {
31: return pathToFile.createNewFile();
32: }
33:
34: public File getFile() {
35: return pathToFile;
36: }
37:
38: public TCFile createNewTCFile(TCFile location, String fileName) {
39: return new TCFileImpl(location, fileName);
40: }
41:
42: public String toString() {
43: return pathToFile.toString();
44: }
45: }
|