Ok, I've got a problem, I have a function wich can check the file extension of all the files in a dir with FilenameFilter, but now I want to do a much simpler thing, but I don't know how to do it. I want to check the extension of only 1 file, but the problem I find is that the only way I know of invoking the FilenameFilter class is by making a File.list(), and as my File path is the path to a file and not to a dir, this doesn't work. Anyone knows how to do it? Thanks.
posted 10 years ago
Ok, I did what I should have done before posting, I've taken a look to the code for a second, and I've realized how easy the answer was, Here it is:
I can't call the FilenameFilter class without making a File.list(), but I can create a FilenameFilter object and then invoke it's accept function giving it the pathname to my file as a parameter:
this.ruta is the path to the file I want to check. I hope this is helpful to someone.