com.google.common.io
Class PatternFilenameFilter

java.lang.Object
  extended by com.google.common.io.PatternFilenameFilter
All Implemented Interfaces:
FilenameFilter

@Beta
public final class PatternFilenameFilter
extends Object
implements FilenameFilter

File name filter that only accepts files matching a regular expression.

Since:
1
Author:
Apple Chow

Constructor Summary
PatternFilenameFilter(Pattern pattern)
          Constructs a pattern file name filter object.
PatternFilenameFilter(String patternStr)
          Constructs a pattern file name filter object.
 
Method Summary
 boolean accept(File dir, String fileName)
          Tests if a specified file should be included in a file list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PatternFilenameFilter

public PatternFilenameFilter(String patternStr)
Constructs a pattern file name filter object.

Parameters:
patternStr - the pattern string on which to filter file names
Throws:
PatternSyntaxException - if pattern compilation fails (runtime)

PatternFilenameFilter

public PatternFilenameFilter(Pattern pattern)
Constructs a pattern file name filter object.

Parameters:
pattern - the pattern on which to filter file names
Method Detail

accept

public boolean accept(File dir,
                      String fileName)
Description copied from interface: java.io.FilenameFilter
Tests if a specified file should be included in a file list.

Specified by:
accept in interface FilenameFilter
Parameters:
dir - the directory in which the file was found.
fileName - the name of the file.
Returns:
true if and only if the name should be included in the file list; false otherwise.