com.soulgalore.velocity.FileTool Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xml-velocity Show documentation
Show all versions of xml-velocity Show documentation
Merge a XML file with a Velocity template
package com.soulgalore.velocity;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
public class FileTool {
private Map simpleCache = new HashMap();
public static final String TEMPLATE_HOME_PROPERTY = "com.soulgalore.velocity.templates.home";
public FileTool() {
}
// unsync
public boolean doFileExist(String path) {
if (simpleCache.containsKey(path))
return simpleCache.get(path);
else {
if (!path.startsWith("/"))
path = System.getProperty(TEMPLATE_HOME_PROPERTY, ".") + "/"
+ path;
File file = new File(path);
Boolean exists = file.exists();
simpleCache.put(path, exists);
return exists;
}
}
// Used for debugging
public String fullPath(String path) {
File file = new File(path);
return file.getAbsolutePath();
}
}