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

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

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

Filters files based on size, can filter either smaller files or files equal to or larger than a given threshold. 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 Rahul Akolkar

See Also:
Serialized Form

Constructor Summary
SizeFileFilter(long size)
          Constructs a new size file filter for files equal to or larger than a certain size.
SizeFileFilter(long size, boolean acceptLarger)
          Constructs a new size file filter for files based on a certain size threshold.
 
Method Summary
 boolean accept(FileIf file)
          Checks to see if the size of the file is favorable.
 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

SizeFileFilter

public SizeFileFilter(long size)
Constructs a new size file filter for files equal to or larger than a certain size.

Parameters:
size - the threshold size of the files
Throws:
java.lang.IllegalArgumentException - if the size is negative

SizeFileFilter

public SizeFileFilter(long size,
                      boolean acceptLarger)
Constructs a new size file filter for files based on a certain size threshold.

Parameters:
size - the threshold size of the files
acceptLarger - if true, files equal to or larger are accepted, otherwise smaller ones (but not equal to)
Throws:
java.lang.IllegalArgumentException - if the size is negative
Method Detail

accept

public boolean accept(FileIf file)
Checks to see if the size of the file is favorable.

If size equals threshold and smaller files are required, file IS NOT selected. If size equals threshold and larger files are required, file IS selected.

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