Package com.iizix.util
Class WindowsLikeFilenameFilter
java.lang.Object
com.iizix.util.WindowsLikeFilenameFilter
- All Implemented Interfaces:
- FilenameFilter
Filters file names like under Windows, with '?' being any character, '*' being any characters and '^' the escape character (the meaning of '?' and '*' becomes the actual character, and two escape characters for a single).
- Constructor SummaryConstructorsConstructorDescription- WindowsLikeFilenameFilter- (String filter) Creates the instance of the file name filter that is case sensitive.- WindowsLikeFilenameFilter- (String filter, boolean isCaseSensitive) Creates the instance of the file name filter that is case sensitive.
- Method SummaryModifier and TypeMethodDescription- booleanTests if a specified file should be included in a file list with the current filter.- booleanGets the case sensitivity flag.Gets the current filter string.- boolean- isMatching- (String name) Checks if a name matches a filter string like under Windows, with '?' being any character, '*' being any characters and '^' the escape character (the meaning of '?' and '*' becomes the actual character, and two escape characters for a single).- static boolean- isMatching- (String name, int namePos, String filter, int filterPos, boolean isCaseSensitive) Checks for a partial match.- static boolean- isMatching- (String name, String filter) Checks if a name matches a filter string like under Windows, with '?' being any character, '*' being any characters and '^' the escape character (the meaning of '?' and '*' becomes the actual character, and two escape characters for a single).- static boolean- isMatching- (String name, String filter, boolean isCaseSensitive, boolean replaceStarDotStar) Checks if a name matches a filter string like under Windows, with '?' being any character, '*' being any characters and '^' the escape character (the meaning of '?' and '*' becomes the actual character, and two escape characters for a single).- void- setCaseSensitivity- (boolean on) Sets the case sensitivity flag.- voidSets a new filter string.
- Constructor Details- WindowsLikeFilenameFilterCreates the instance of the file name filter that is case sensitive. Setting the- filterparameter to null will include all files.
- WindowsLikeFilenameFilterCreates the instance of the file name filter that is case sensitive. Setting the- filterparameter to null will include all files.
 
- Method Details- setFilterSets a new filter string. Setting the- filterparameter to null will include all files.
- getFilterGets the current filter string.- Returns:
- null if all files are included, otherwise the current filter string.
 
- setCaseSensitivitypublic void setCaseSensitivity- (boolean on) Sets the case sensitivity flag.
- getCaseSensitivitypublic boolean getCaseSensitivity()Gets the case sensitivity flag.
- acceptTests if a specified file should be included in a file list with the current filter.- Specified by:
- acceptin interface- FilenameFilter
- Parameters:
- dir- - the directory in which the file was found.
- name- - the name of the file.
- Returns:
- true if the name should be included in the file list; false otherwise.
 
- isMatchingChecks if a name matches a filter string like under Windows, with '?' being any character, '*' being any characters and '^' the escape character (the meaning of '?' and '*' becomes the actual character, and two escape characters for a single).- Note: "*.*" is replaced with "*" as filter if equal. 
- isMatchingChecks if a name matches a filter string like under Windows, with '?' being any character, '*' being any characters and '^' the escape character (the meaning of '?' and '*' becomes the actual character, and two escape characters for a single).- Note: "*.*" is replaced with "*" as filter if equal. 
- isMatchingpublic static boolean isMatching- (String name, String filter, boolean isCaseSensitive, boolean replaceStarDotStar) Checks if a name matches a filter string like under Windows, with '?' being any character, '*' being any characters and '^' the escape character (the meaning of '?' and '*' becomes the actual character, and two escape characters for a single).
- isMatchingpublic static boolean isMatching- (String name, int namePos, String filter, int filterPos, boolean isCaseSensitive) Checks for a partial match. This function is recursive. The parameters are the file name string and starting position in it and then the filter string with a starting filter position.- Returns:
- true for a match; false otherwise.