|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.io.filefilter.AbstractFileFilter
org.apache.commons.io.filefilter.AgeFileFilter
public class AgeFileFilter
Filters files based on a cutoff time, can filter either older or newer files.
For example, to print all files and directories in the current directory older than one day:
File dir = new File("."); // We are interested in files older than one day long cutoff = System.currentTimeMillis() - (24 * 60 * 60 * 1000); String[] files = dir.list( new AgeFileFilter(cutoff) ); for ( int i = 0; i < files.length; i++ ) { System.out.println(files[i]); }
Field Summary | |
---|---|
private boolean |
acceptOlder
Whether the files accepted will be older or newer. |
private long |
cutoff
The cutoff time threshold. |
Constructor Summary | |
---|---|
AgeFileFilter(java.util.Date cutoffDate)
Constructs a new age file filter for files older than 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(java.io.File cutoffReference)
Constructs a new age file filter for files older than a certain File (whose last modification time will be used as reference). |
|
AgeFileFilter(java.io.File 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 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(java.io.File file)
Checks to see if the last modification of the file matches cutoff favorably. |
Methods inherited from class org.apache.commons.io.filefilter.AbstractFileFilter |
---|
accept |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private long cutoff
private boolean acceptOlder
Constructor Detail |
---|
public AgeFileFilter(long cutoff)
cutoff
- the threshold age of the filespublic AgeFileFilter(long cutoff, boolean acceptOlder)
cutoff
- the threshold age of the filesacceptOlder
- if true, older files are accepted, else newer onespublic AgeFileFilter(java.util.Date cutoffDate)
cutoffDate
- the threshold age of the filespublic AgeFileFilter(java.util.Date cutoffDate, boolean acceptOlder)
cutoffDate
- the threshold age of the filesacceptOlder
- if true, older files are accepted, else newer onespublic AgeFileFilter(java.io.File cutoffReference)
cutoffReference
- the file whose last modification
time is usesd as the threshold age of the filespublic AgeFileFilter(java.io.File cutoffReference, boolean acceptOlder)
cutoffReference
- the file whose last modification
time is usesd as the threshold age of the filesacceptOlder
- if true, older files are accepted, else newer onesMethod Detail |
---|
public boolean accept(java.io.File file)
accept
in interface java.io.FileFilter
accept
in interface IOFileFilter
accept
in class AbstractFileFilter
file
- the File to check
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |