I want to write in java something like this:
public class MyMatcher
{
public static boolean isMatching(String filename, String param) {
...
}
}
filename would be the name of a file without the directory
(e.g.: readme.txt, shares.csv, a nice song.mp3, …)
param would be something like “*.mp3” to say all of the files ending with .mp3 and so on.
Note: param is not regular expression statement is more like the usual way of searching files like on textpad or eclipse or even the dos dir.
Can somebody suggest either how to do this or if there is some opensource library to do this ?
Apache Commons IO has a WilcardFileFilter:
Example from the javadoc: