Java FileFilters

It's always bothered me that there wasn't a decent default implementation of FileFilter or FilenameFilter. It seems like such a basic service that the platform should supply some. Thanks to the folks at Jakarta you don't have to write all your own.
The Jakarta ORO project provides a few very nice ones: GlobFilenameFilter, AwkFilenameFilter and Perl5FilenameFilter.


The Jakarta Commons package also has some simple ones that perform logical opertation on other filters: AndFileFilter, OrFileFilter and NotFileFilter.



If you really don't want to write your own you can also buy some. This collection is for sale at the odd price of '$26.70 East Caribbean Dolla' or standard $10.00 US. I don't know the conversion rate for East Caribbean Dolla but I hope it works out to less than 10 US. Neither seems like much of a deal.



While these are all fine and dandy I still feel like there's something missing. The filter that started me thinking about this was my desire for a simple exclusion filter to implement ANT like exclude capabilities. This led me thinking further about size filters and date filters, recursive listFiles methods, sorting decorators etc... Sounds like the roots of a little side project. Maybe if I find the time.

Comments

Popular posts from this blog

Shark Crackers

Running roughshod or ripshod

Axis, Axes, Axii?