jodd.file.filters
Class RegExpFileFilter

java.lang.Object
  extended byjodd.file.filters.RegExpFileFilter
All Implemented Interfaces:
java.io.FileFilter

public class RegExpFileFilter
extends java.lang.Object
implements java.io.FileFilter

FileFilter that matches files with use of regular expression. By default, both files and directories are matched, but only by their name (not including path). This behaviour can be changed by using the following flags:

Here are some tips for regular expressions: Note: when path is also used for matching (flag p), it is assumed that file separators are unix-like, to prevent complications. This is done because File understands unix-like file separators, no matter what underlying system really is (at least it works so on windows). Therefore, regexp patterns should written for unix-like file names.


Constructor Summary
RegExpFileFilter(java.lang.String regexp)
          Regular Expression file filter with default behaviour.
RegExpFileFilter(java.lang.String regexp, java.lang.String opt)
          Regular Expression file filter.
 
Method Summary
 boolean accept(java.io.File f)
          Tests whether or not the specified File matches conditions.
 boolean getMatchPath()
           
 boolean getSkipDirs()
           
 void setMatchPath(boolean v)
          Set match path flag.
 void setSkipDirs(boolean v)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RegExpFileFilter

public RegExpFileFilter(java.lang.String regexp,
                        java.lang.String opt)
Regular Expression file filter.

Parameters:
regexp - regexp pattern
opt - subset of following flags:

RegExpFileFilter

public RegExpFileFilter(java.lang.String regexp)
Regular Expression file filter with default behaviour.

Parameters:
regexp - regexp pattern
Method Detail

setMatchPath

public void setMatchPath(boolean v)
Set match path flag.

Parameters:
v -

getMatchPath

public boolean getMatchPath()

setSkipDirs

public void setSkipDirs(boolean v)

getSkipDirs

public boolean getSkipDirs()

accept

public boolean accept(java.io.File f)
Tests whether or not the specified File matches conditions.

Specified by:
accept in interface java.io.FileFilter
Parameters:
f - file to be tested
Returns:
true if file matches ok, otherwise false


Jodd v0.24.5 Javadoc