org.geotools.io
Class DefaultFileFilter

java.lang.Object
  extended by javax.swing.filechooser.FileFilter
      extended by org.geotools.io.DefaultFileFilter
All Implemented Interfaces:
java.io.FileFilter, java.io.FilenameFilter

public class DefaultFileFilter
extends javax.swing.filechooser.FileFilter
implements java.io.FileFilter, java.io.FilenameFilter

A FileFilter implementation using Unix-style wildcards.

Since:
2.0
Version:
$Id: DefaultFileFilter.java 30640 2008-06-12 17:34:32Z acuster $
Author:
Martin Desruisseaux (IRD)

Constructor Summary
DefaultFileFilter(java.lang.String pattern)
          Constructs a file filter for the specified pattern.
DefaultFileFilter(java.lang.String pattern, java.lang.String description)
          Constructs a file filter for the specified pattern and description.
 
Method Summary
 boolean accept(java.io.File file)
          Tests if a specified file matches the pattern.
 boolean accept(java.io.File directory, java.lang.String name)
          Tests if a specified file matches the pattern.
 java.lang.String getDescription()
          Returns 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

DefaultFileFilter

public DefaultFileFilter(java.lang.String pattern)
Constructs a file filter for the specified pattern. The pattern can contains the "*" and "?" wildcards.

Parameters:
pattern - The pattern (e.g. "*.png").

DefaultFileFilter

public DefaultFileFilter(java.lang.String pattern,
                         java.lang.String description)
Constructs a file filter for the specified pattern and description. The pattern can contains the "*" and "?" wildcards.

Parameters:
pattern - The pattern (e.g. "*.png").
description - The description of this filter, usually for graphical user interfaces.
Method Detail

getDescription

public java.lang.String getDescription()
Returns the description of this filter. For example: "PNG images".

Specified by:
getDescription in class javax.swing.filechooser.FileFilter

accept

public boolean accept(java.io.File file)
Tests if a specified file matches the pattern.

Specified by:
accept in interface java.io.FileFilter
Specified by:
accept in class javax.swing.filechooser.FileFilter
Parameters:
file - The file to be tested.
Returns:
true if and only if the name matches the pattern.

accept

public boolean accept(java.io.File directory,
                      java.lang.String name)
Tests if a specified file matches the pattern.

Specified by:
accept in interface java.io.FilenameFilter
Parameters:
directory - The directory in which the file was found.
name - The name of the file.
Returns:
true if and only if the name matches the pattern.


Copyright © 1996-2010 Geotools. All Rights Reserved.