JAPI 0.9.0
Yet another Java API
API Documentation

net.sf.japi.util.filter.file
Class RegexFileFilter

java.lang.Object
  extended by javax.swing.filechooser.FileFilter
      extended by net.sf.japi.util.filter.file.AbstractFileFilter
          extended by net.sf.japi.util.filter.file.RegexFileFilter
All Implemented Interfaces:
FileFilter, Filter<File>
Direct Known Subclasses:
GlobFileFilter

public class RegexFileFilter
extends AbstractFileFilter

A FileFilter implementation that matches against a regular expression.

Author:
Christian Hujer
See Also:
Pattern
Todo:
allow setting the description

Nested Class Summary
 
Nested classes/interfaces inherited from interface net.sf.japi.util.filter.Filter
Filter.Factory
 
Constructor Summary
RegexFileFilter(Pattern... patterns)
          Create a RegexFileFilter.
RegexFileFilter(String... patterns)
          Create a RegexFileFilter.
 
Method Summary
 boolean accept(File pathname)
          Whether the given file is accepted by this filter.
 String getDescription()
          The description of this filter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RegexFileFilter

public RegexFileFilter(String... patterns)
Create a RegexFileFilter.

Parameters:
patterns - String of Pattern to match against
Notes:
The patterns is verified using Matcher.matches(), which means the whole filename (but excluding path) is matched.

RegexFileFilter

public RegexFileFilter(Pattern... patterns)
Create a RegexFileFilter.

Parameters:
patterns - Patterns to match against
Notes:
The pattern is verified using Matcher.matches(), which means the whole filename (but excluding path) is matched.
Method Detail

accept

public boolean accept(File pathname)
Whether the given file is accepted by this filter.

Specified by:
accept in interface FileFilter
Specified by:
accept in interface Filter<File>
Specified by:
accept in class FileFilter
Parameters:
pathname - The abstract pathname to be tested
Returns:
true if and only if pathname should be included

getDescription

public String getDescription()
The description of this filter. For example: "JPG and GIF Images"

Specified by:
getDescription in class FileFilter
See Also:
FileView.getName(java.io.File)

JAPI
Yet another Java API
API Documentation

© 2005-2006 Christian Hujer. All rights reserved. See copyright