Class ExtensionFileFilter
- java.lang.Object
-
- com.anaptecs.jeaf.tools.impl.file.ExtensionFileFilter
-
- All Implemented Interfaces:
java.io.FilenameFilter
public class ExtensionFileFilter extends java.lang.Object implements java.io.FilenameFilter
Class implements interface FilenameFilter to filter all files by its extension. The class implements two ways to filter files. By default all files that do have the defined extensions are accepted. In addition the class also provides the possibility to specify an exclusion list of explicit file names.- Version:
- 1.0
- Author:
- JEAF Development Team
-
-
Constructor Summary
Constructors Constructor Description ExtensionFileFilter(java.util.List<java.lang.String> pAcceptedExtensions)
Constructor initializes the object.ExtensionFileFilter(java.util.List<java.lang.String> pAcceptedExtensions, java.util.List<java.lang.String> pExclusionList)
Constructor initializes the filter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
accept(java.io.File pDirectory, java.lang.String pFilename)
Method checks whether the file with the passed name is a accepted by the filter or not.
-
-
-
Constructor Detail
-
ExtensionFileFilter
public ExtensionFileFilter(java.util.List<java.lang.String> pAcceptedExtensions)
Constructor initializes the object. Thereby no actions are performed. The object does not use an exclusion list.- Parameters:
pAcceptedExtensions
- List contains the white list for all file extensions that should be accepted by the filter. The extensions can be provided with or without a leading star operator (*.txt or .txt / *.hbm.xml or .hbm.xml). First characters must either be '*.' or '.' and the trimmed string must at least contain 1 real character in addition to the mentioned prefix. If the passed list of accepted extensions is null or empty then this means that all extensions are accepted.
-
ExtensionFileFilter
public ExtensionFileFilter(java.util.List<java.lang.String> pAcceptedExtensions, java.util.List<java.lang.String> pExclusionList)
Constructor initializes the filter. Thereby a set of excluded files is passed to the object. The exclusion list is an additional feature of the filter in addition to the extension based filtering.- Parameters:
pAcceptedExtensions
- List contains the white list for all file extensions that should be accepted by the filter. The extensions can be provided with or without a leading star operator (*.txt or .txt / *.hbm.xml or .hbm.xml). First characters must either be '*.' or '.' and the trimmed string must at least contain 1 real character in addition to the mentioned prefix. If the passed list of accepted extensions is null or empty then this means that all extensions are accepted.pExclusionList
- List contains names of all files that should be excluded by the filter. The file names must not contain any path information. The parameter may be null.
-
-
Method Detail
-
accept
public boolean accept(java.io.File pDirectory, java.lang.String pFilename)
Method checks whether the file with the passed name is a accepted by the filter or not.- Specified by:
accept
in interfacejava.io.FilenameFilter
- Parameters:
pDirectory
- File object representing the directory in which the file was found. The parameter is never used.pFilename
- Name of the file that should be checked for compliance with this filter. The parameter must not be null.- Returns:
- boolean Method returns true if pFile is accepted by the filter and false in all other cases.
- See Also:
FileFilter.accept(java.io.File)
-
-