public class ExtensionFileFilter extends FileFilter implements FilenameFilter, Serializable
| Constructor and Description |
|---|
ExtensionFileFilter(String[] extensions,
String description)
Creates an ExtensionFileFilter that accepts files that have any of the
extensions contained in the supplied array.
|
ExtensionFileFilter(String extension,
String description)
Creates the ExtensionFileFilter
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
accept(File file)
Returns true if the supplied file should be accepted (i.e.: if it has the
required extension or is a directory).
|
boolean |
accept(File dir,
String name)
Returns true if the file in the given directory with the given name should
be accepted.
|
String |
getDescription()
Gets the description of accepted files.
|
String[] |
getExtensions()
Returns a copy of the acceptable extensions.
|
public ExtensionFileFilter(String extension, String description)
extension - the extension of accepted files.description - a text description of accepted files.public ExtensionFileFilter(String[] extensions, String description)
extensions - an array of acceptable file extensions (as Strings).description - a text description of accepted files.public String getDescription()
getDescription in class FileFilterpublic String[] getExtensions()
public boolean accept(File file)
accept in class FileFilterfile - the file of interest.public boolean accept(File dir, String name)
accept in interface FilenameFilterdir - the directory where the file resides.name - the name of the file.Copyright © 2014 University of Waikato, Hamilton, NZ. All Rights Reserved.