org.geotools.io
Class DefaultFileFilter

java.lang.Object
  extended byjavax.swing.filechooser.FileFilter
      extended byorg.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 17672 2006-01-19 00:25:55Z desruisseaux $
Author:
Martin Desruisseaux

Constructor Summary
DefaultFileFilter(java.lang.String pattern)
          Construct a file filter for the specified pattern.
DefaultFileFilter(java.lang.String pattern, java.lang.String description)
          Construct 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 dir, 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)
Construct a file filter for the specified pattern. Pattern may contains the "*" and "?" wildcards.

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

DefaultFileFilter

public DefaultFileFilter(java.lang.String pattern,
                         java.lang.String description)
Construct a file filter for the specified pattern and description. Pattern may 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"


accept

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

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

accept

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

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


Copyright © GeoTools. All Rights Reserved.