All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jodd.io.filter.FileFilterBase Maven / Gradle / Ivy

Go to download

Jodd Core tools and utilities, including type converters, JDateTime, cache etc.

There is a newer version: 5.3.0
Show newest version
// 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));
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy