com.teamdev.filewatch
Class FileMaskFilter

java.lang.Object
  extended by com.teamdev.filewatch.FileMaskFilter
All Implemented Interfaces:
FileEventFilter, java.io.FileFilter

public class FileMaskFilter
extends java.lang.Object
implements FileEventFilter, java.io.FileFilter

This filter provides the functionality for filtering file events by a file mask.


Constructor Summary
FileMaskFilter(java.lang.String fileMasks)
          Creates a new filter by the specified file mask or file masks divided by ; separator.
 
Method Summary
 boolean accept(java.io.File pathname)
          Verifies if a given file matches this file mask.
 boolean accept(FileEvent e)
          Tests if the specified event should be processed further.
 java.lang.String getFileMask()
          Returns file mask.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileMaskFilter

public FileMaskFilter(java.lang.String fileMasks)
Creates a new filter by the specified file mask or file masks divided by ; separator. Exact filename or wildcards can be used in the mask.

Examples:
  *.java;*cpp;*.txt - filter for java, cpp and text files;

Parameters:
fileMasks - is the file mask filter.
Method Detail

getFileMask

public java.lang.String getFileMask()
Returns file mask.

Returns:
file mask string

accept

public boolean accept(java.io.File pathname)
Verifies if a given file matches this file mask.

Specified by:
accept in interface java.io.FileFilter
Parameters:
pathname - file to check
Returns:
true if the file matches the mask; false otherwise

accept

public boolean accept(FileEvent e)
Tests if the specified event should be processed further.

Specified by:
accept in interface FileEventFilter
Parameters:
e - a new event discovered by a FileWatcher
Returns:
true if and only if the filter accepts the event