1 4 package com.tc.io; 5 6 import org.apache.commons.io.FileUtils; 7 8 import java.io.File ; 9 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 } 46 | Popular Tags |