bb.io.filefilter
Class ShellScriptFileFilter
java.lang.Object
javax.swing.filechooser.FileFilter
bb.io.filefilter.FilenameSuffixFilter
bb.io.filefilter.ShellScriptFileFilter
- All Implemented Interfaces:
- FileFilter
public class ShellScriptFileFilter
- extends FilenameSuffixFilter
File filter that accepts shell script files.
Currently, this file filter accepts only those files that end with the following file extensions (case irrelevant):
.bat
.sh
Note that this class is both a subclass of javax.swing.filechooser.FileFilter
(so that it can be passed to JFileChooser
),
as well as an implementation of java.io.FileFilter
(so that it is suitable as an argument to File.listFiles
).
This class is multithread safe: it is immutable (both its immediate state, as well as the deep state of its fields).
- Author:
- Brent Boyer
Constructor Summary |
ShellScriptFileFilter()
Constructs a new ShellScriptFileFilter instance; directories are accepted. |
ShellScriptFileFilter(boolean acceptDirectory)
Constructs a new ShellScriptFileFilter instance with the specification for whether to accept directories or not. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
suffixes
private static final String[] suffixes
description
private static final String description
ShellScriptFileFilter
public ShellScriptFileFilter()
- Constructs a new ShellScriptFileFilter instance; directories are accepted.
ShellScriptFileFilter
public ShellScriptFileFilter(boolean acceptDirectory)
- Constructs a new ShellScriptFileFilter instance with the specification for whether to accept directories or not.
getDescription
public String getDescription()
- Returns a description of this filter.
- Specified by:
getDescription
in class FilenameSuffixFilter