jodd.io.filter.FileFilterBase Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jodd-core Show documentation
Show all versions of jodd-core Show documentation
Jodd Core tools and utilities, including type converters, JDateTime, cache etc.
// Copyright (c) 2003-2014, Jodd Team (jodd.org). All Rights Reserved.
package jodd.io.filter;
import java.io.File;
/**
* Base implementation of {@link FileFilterEx}.
* Implement either one of provided methods.
*/
abstract class FileFilterBase implements FileFilterEx {
/**
* Tests whether or not the specified abstract pathname should be
* included in a pathname list.
*
* @param file The abstract pathname to be tested
* @return true
if and only if pathname
* should be included
*/
public boolean accept(File file) {
return accept(file.getParentFile(), file.getName());
}
/**
* Tests if a specified file should be included in a file list.
*
* @param dir the directory in which the file was found.
* @param name the name of the file.
* @return true
if and only if the name should be
* included in the file list; false
otherwise.
*/
public boolean accept(File dir, String name) {
return accept(new File(dir, name));
}
}