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

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

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

Filters filenames for a certain name. 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 authors Stephen Colebourne, Federico Barbieri, Serge Knystautas, Peter Donald

See Also:
Serialized Form

Constructor Summary
NameFileFilter(java.util.List<java.lang.String> names)
          Constructs a new case-sensitive name file filter for a list of names.
NameFileFilter(java.util.List<java.lang.String> names, org.apache.commons.io.IOCase caseSensitivity)
          Constructs a new name file filter for a list of names specifying case-sensitivity.
NameFileFilter(java.lang.String name)
          Constructs a new case-sensitive name file filter for a single name.
NameFileFilter(java.lang.String[] names)
          Constructs a new case-sensitive name file filter for an array of names.
NameFileFilter(java.lang.String[] names, org.apache.commons.io.IOCase caseSensitivity)
          Constructs a new name file filter for an array of names specifying case-sensitivity.
NameFileFilter(java.lang.String name, org.apache.commons.io.IOCase caseSensitivity)
          Construct a new name file filter specifying case-sensitivity.
 
Method Summary
 boolean accept(FileIf file)
          Checks to see if the filename matches.
 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

NameFileFilter

public NameFileFilter(java.lang.String name)
Constructs a new case-sensitive name file filter for a single name.

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

NameFileFilter

public NameFileFilter(java.lang.String name,
                      org.apache.commons.io.IOCase caseSensitivity)
Construct a new name file filter specifying case-sensitivity.

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

NameFileFilter

public NameFileFilter(java.lang.String[] names)
Constructs a new case-sensitive name file filter for an array of names.

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

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

NameFileFilter

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

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

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

NameFileFilter

public NameFileFilter(java.util.List<java.lang.String> names)
Constructs a new case-sensitive name file filter for a list of names.

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

NameFileFilter

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

Parameters:
names - the names to allow, must not be null
caseSensitivity - how to handle case sensitivity, null means case-sensitive
Throws:
java.lang.IllegalArgumentException - if the name 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 matches.

Specified by:
accept in interface IOFileFilter
Parameters:
file - the File to check
Returns:
true if the filename matches

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