public class ExtensionFilenameFilter extends Object implements FilenameFilter, FileFilter
FilenameFilter that only returns
files if the have one of the specified file extensions. More than one file
extension can be specified by using the addExtension(String) method.| Constructor and Description |
|---|
ExtensionFilenameFilter()
Construct a new ExtensionFilenameFilter.
|
ExtensionFilenameFilter(boolean readOnly,
String... extensions)
Construct a new ExtensionFilenameFilter.
|
ExtensionFilenameFilter(Collection<String> extensions)
Construct a new ExtensionFilenameFilters.
|
ExtensionFilenameFilter(Collection<String> extensions,
boolean readOnly)
Construct a new ExtensionFilenameFilter.
|
ExtensionFilenameFilter(String... extensions)
Construct a new ExtensionFilenameFilter.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
accept(File file) |
boolean |
accept(File directory,
String fileName)
Check to see if the file should be included in the list of matched files
|
boolean |
accept(String fileName) |
void |
addExtension(String extension)
Add the file extension to the extensions to find.
|
void |
addExtensions(Collection<String> extensions)
Add the file extensions to the extensions to find.
|
protected boolean |
isReadOnly()
Get the flag indicating if the filter can be modified.
|
protected void |
setReadOnly(boolean readOnly)
Set the flag indicating if the filter can be modified.
|
public ExtensionFilenameFilter()
public ExtensionFilenameFilter(boolean readOnly,
String... extensions)
extensions - The file extensions.readOnly - Flag indicating if the filter can be modified.public ExtensionFilenameFilter(Collection<String> extensions)
extensions - The file extensions.public ExtensionFilenameFilter(Collection<String> extensions, boolean readOnly)
extensions - The file extensions.readOnly - Flag indicating if the filter can be modified.public ExtensionFilenameFilter(String... extensions)
extensions - The file extensions.public boolean accept(File file)
accept in interface FileFilterpublic boolean accept(File directory, String fileName)
accept in interface FilenameFilterdirectory - The directory in which the file was found.fileName - The name of the file.public boolean accept(String fileName)
public void addExtension(String extension)
extension - The file extension.public void addExtensions(Collection<String> extensions)
extensions - The file extensions.protected final boolean isReadOnly()
protected final void setReadOnly(boolean readOnly)
readOnly - The flag indicating if the filter can be modified.Copyright © 2015 Revolution Systems Inc.. All rights reserved.