Code example for File

Methods: lastModified

0
		this.encoding = encoding;
	} 
 
	public long getLastModified(String name) {
		File templateSource = getFile(name);
		return templateSource.lastModified();
	} 
 
	@Override 
	public Reader getReader(String name) throws IOException {
		File templateSource = getFile(name);
		return new InputStreamReader(new FileInputStream(templateSource), encoding);
	} 
 
	private File getFile(String name) {
		// TODO Security 
		String filename = basePath + name;
		if (hasNoExtension(filename)) {
        	filename += suffix;
        } 
 
		return new File(filename);
	} 
 
    private boolean hasNoExtension(String filename) {
        return "".equals(FilenameUtils.getExtension(filename));
    }