com.armatiek.infofuze.stream.filesystem.filefilter
Class SuffixFileFilter

java.lang.Object
  extended by com.armatiek.infofuze.stream.filesystem.filefilter.SuffixFileFilter
All Implemented Interfaces:
IOFileFilter, java.io.Serializable

public class SuffixFileFilter
extends java.lang.Object
implements IOFileFilter, java.io.Serializable

Filters files based on the suffix (what the filename ends with). This is used in retrieving all the files of a particular type. Based on code from Apache Commons IO version 2.01. The main difference is that this class filters objects that implement FileIf, not File. Original author Stephen Colebourne, Federico Barbieri, Serge Knystautas, Peter Donald

See Also:
Serialized Form

Constructor Summary
SuffixFileFilter(java.util.List<java.lang.String> suffixes)
          Constructs a new Suffix file filter for a list of suffixes.
SuffixFileFilter(java.util.List<java.lang.String> suffixes, org.apache.commons.io.IOCase caseSensitivity)
          Constructs a new Suffix file filter for a list of suffixes specifying case-sensitivity.
SuffixFileFilter(java.lang.String suffix)
          Constructs a new Suffix file filter for a single extension.
SuffixFileFilter(java.lang.String[] suffixes)
          Constructs a new Suffix file filter for an array of suffixs.
SuffixFileFilter(java.lang.String[] suffixes, org.apache.commons.io.IOCase caseSensitivity)
          Constructs a new Suffix file filter for an array of suffixs specifying case-sensitivity.
SuffixFileFilter(java.lang.String suffix, org.apache.commons.io.IOCase caseSensitivity)
          Constructs a new Suffix file filter for a single extension specifying case-sensitivity.
 
Method Summary
 boolean accept(FileIf file)
          Checks to see if the filename ends with the suffix.
 java.lang.String toString()
          Provide a String representaion of this file filter.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SuffixFileFilter

public SuffixFileFilter(java.lang.String suffix)
Constructs a new Suffix file filter for a single extension.

Parameters:
suffix - the suffix to allow, must not be null
Throws:
java.lang.IllegalArgumentException - if the suffix is null

SuffixFileFilter

public SuffixFileFilter(java.lang.String suffix,
                        org.apache.commons.io.IOCase caseSensitivity)
Constructs a new Suffix file filter for a single extension specifying case-sensitivity.

Parameters:
suffix - the suffix to allow, must not be null
caseSensitivity - how to handle case sensitivity, null means case-sensitive
Throws:
java.lang.IllegalArgumentException - if the suffix is null

SuffixFileFilter

public SuffixFileFilter(java.lang.String[] suffixes)
Constructs a new Suffix file filter for an array of suffixs.

The array is not cloned, so could be changed after constructing the instance. This would be inadvisable however.

Parameters:
suffixes - the suffixes to allow, must not be null
Throws:
java.lang.IllegalArgumentException - if the suffix array is null

SuffixFileFilter

public SuffixFileFilter(java.lang.String[] suffixes,
                        org.apache.commons.io.IOCase caseSensitivity)
Constructs a new Suffix file filter for an array of suffixs specifying case-sensitivity.

The array is not cloned, so could be changed after constructing the instance. This would be inadvisable however.

Parameters:
suffixes - the suffixes to allow, must not be null
caseSensitivity - how to handle case sensitivity, null means case-sensitive
Throws:
java.lang.IllegalArgumentException - if the suffix array is null

SuffixFileFilter

public SuffixFileFilter(java.util.List<java.lang.String> suffixes)
Constructs a new Suffix file filter for a list of suffixes.

Parameters:
suffixes - the suffixes to allow, must not be null
Throws:
java.lang.IllegalArgumentException - if the suffix list is null
java.lang.ClassCastException - if the list does not contain Strings

SuffixFileFilter

public SuffixFileFilter(java.util.List<java.lang.String> suffixes,
                        org.apache.commons.io.IOCase caseSensitivity)
Constructs a new Suffix file filter for a list of suffixes specifying case-sensitivity.

Parameters:
suffixes - the suffixes to allow, must not be null
caseSensitivity - how to handle case sensitivity, null means case-sensitive
Throws:
java.lang.IllegalArgumentException - if the suffix list is null
java.lang.ClassCastException - if the list does not contain Strings
Method Detail

accept

public boolean accept(FileIf file)
Checks to see if the filename ends with the suffix.

Specified by:
accept in interface IOFileFilter
Parameters:
file - the File to check
Returns:
true if the filename ends with one of our suffixes

toString

public java.lang.String toString()
Provide a String representaion of this file filter.

Overrides:
toString in class java.lang.Object
Returns:
a String representaion