bb.io.filefilter
Class ShellScriptFileFilter

java.lang.Object
  extended by javax.swing.filechooser.FileFilter
      extended by bb.io.filefilter.FilenameSuffixFilter
          extended by 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):

  1. .bat
  2. .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

Nested Class Summary
 
Nested classes/interfaces inherited from class bb.io.filefilter.FilenameSuffixFilter
FilenameSuffixFilter.UnitTest
 
Field Summary
private static String description
           
private static String[] suffixes
           
 
Fields inherited from class bb.io.filefilter.FilenameSuffixFilter
acceptDirectories, filterDirectoriesBySuffix, rejectDirectories
 
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.
 
Method Summary
 String getDescription()
          Returns a description of this filter.
 
Methods inherited from class bb.io.filefilter.FilenameSuffixFilter
accept, getSuffixes, isValidDirectoryTreatment, makeDescription, suffixMatches
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

suffixes

private static final String[] suffixes

description

private static final String description
Constructor Detail

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.

Method Detail

getDescription

public String getDescription()
Returns a description of this filter.

Specified by:
getDescription in class FilenameSuffixFilter