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

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

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

Filters files based on a cutoff time, can filter either newer files or files equal to or older. 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
AgeFileFilter(java.util.Date cutoffDate)
          Constructs a new age file filter for files older than (at or before) a certain cutoff date.
AgeFileFilter(java.util.Date cutoffDate, boolean acceptOlder)
          Constructs a new age file filter for files on any one side of a certain cutoff date.
AgeFileFilter(FileIf cutoffReference)
          Constructs a new age file filter for files older than (at or before) a certain File (whose last modification time will be used as reference).
AgeFileFilter(FileIf cutoffReference, boolean acceptOlder)
          Constructs a new age file filter for files on any one side of a certain File (whose last modification time will be used as reference).
AgeFileFilter(long cutoff)
          Constructs a new age file filter for files equal to or older than a certain cutoff
AgeFileFilter(long cutoff, boolean acceptOlder)
          Constructs a new age file filter for files on any one side of a certain cutoff.
 
Method Summary
 boolean accept(FileIf file)
          Checks to see if the last modification of the file matches cutoff favorably.
static boolean isFileNewer(FileIf file, long timeMillis)
           
 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

AgeFileFilter

public AgeFileFilter(long cutoff)
Constructs a new age file filter for files equal to or older than a certain cutoff

Parameters:
cutoff - the threshold age of the files

AgeFileFilter

public AgeFileFilter(long cutoff,
                     boolean acceptOlder)
Constructs a new age file filter for files on any one side of a certain cutoff.

Parameters:
cutoff - the threshold age of the files
acceptOlder - if true, older files (at or before the cutoff) are accepted, else newer ones (after the cutoff).

AgeFileFilter

public AgeFileFilter(java.util.Date cutoffDate)
Constructs a new age file filter for files older than (at or before) a certain cutoff date.

Parameters:
cutoffDate - the threshold age of the files

AgeFileFilter

public AgeFileFilter(java.util.Date cutoffDate,
                     boolean acceptOlder)
Constructs a new age file filter for files on any one side of a certain cutoff date.

Parameters:
cutoffDate - the threshold age of the files
acceptOlder - if true, older files (at or before the cutoff) are accepted, else newer ones (after the cutoff).

AgeFileFilter

public AgeFileFilter(FileIf cutoffReference)
Constructs a new age file filter for files older than (at or before) a certain File (whose last modification time will be used as reference).

Parameters:
cutoffReference - the file whose last modification time is usesd as the threshold age of the files

AgeFileFilter

public AgeFileFilter(FileIf cutoffReference,
                     boolean acceptOlder)
Constructs a new age file filter for files on any one side of a certain File (whose last modification time will be used as reference).

Parameters:
cutoffReference - the file whose last modification time is usesd as the threshold age of the files
acceptOlder - if true, older files (at or before the cutoff) are accepted, else newer ones (after the cutoff).
Method Detail

isFileNewer

public static boolean isFileNewer(FileIf file,
                                  long timeMillis)

accept

public boolean accept(FileIf file)
Checks to see if the last modification of the file matches cutoff favorably.

If last modification time equals cutoff and newer files are required, file IS NOT selected. If last modification time equals cutoff and older 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