Skip to content

Commit 5284cea

Browse files
author
Niall Pemberton
committed
IO-89 - Correct AgeFileFilter Javadocs to reflect that it filters either newer files or files equal to or older than the cutoff. Correct SizeFileFilter Javadocs to reflect that it filters either smaller files or files equal to or larger than the threshold.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/io/trunk@463570 13f79535-47bb-0310-9956-ffa450edef68
1 parent a56cc14 commit 5284cea

2 files changed

Lines changed: 30 additions & 15 deletions

File tree

src/java/org/apache/commons/io/filefilter/AgeFileFilter.java

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
import org.apache.commons.io.FileUtils;
2323

2424
/**
25-
* Filters files based on a cutoff time, can filter either older or newer files.
25+
* Filters files based on a cutoff time, can filter either newer
26+
* files or files equal to or older.
2627
* <p>
2728
* For example, to print all files and directories in the
2829
* current directory older than one day:
@@ -49,7 +50,8 @@ public class AgeFileFilter extends AbstractFileFilter {
4950
private boolean acceptOlder;
5051

5152
/**
52-
* Constructs a new age file filter for files older than a certain cutoff.
53+
* Constructs a new age file filter for files equal to or older than
54+
* a certain cutoff
5355
*
5456
* @param cutoff the threshold age of the files
5557
*/
@@ -62,16 +64,17 @@ public AgeFileFilter(long cutoff) {
6264
* of a certain cutoff.
6365
*
6466
* @param cutoff the threshold age of the files
65-
* @param acceptOlder if true, older files are accepted, else newer ones
67+
* @param acceptOlder if true, older files (at or before the cutoff)
68+
* are accepted, else newer ones (after the cutoff).
6669
*/
6770
public AgeFileFilter(long cutoff, boolean acceptOlder) {
6871
this.acceptOlder = acceptOlder;
6972
this.cutoff = cutoff;
7073
}
7174

7275
/**
73-
* Constructs a new age file filter for files older than a certain
74-
* cutoff date.
76+
* Constructs a new age file filter for files older than (at or before)
77+
* a certain cutoff date.
7578
*
7679
* @param cutoffDate the threshold age of the files
7780
*/
@@ -84,15 +87,16 @@ public AgeFileFilter(Date cutoffDate) {
8487
* of a certain cutoff date.
8588
*
8689
* @param cutoffDate the threshold age of the files
87-
* @param acceptOlder if true, older files are accepted, else newer ones
90+
* @param acceptOlder if true, older files (at or before the cutoff)
91+
* are accepted, else newer ones (after the cutoff).
8892
*/
8993
public AgeFileFilter(Date cutoffDate, boolean acceptOlder) {
9094
this(cutoffDate.getTime(), acceptOlder);
9195
}
9296

9397
/**
94-
* Constructs a new age file filter for files older than a certain
95-
* File (whose last modification time will be used as reference).
98+
* Constructs a new age file filter for files older than (at or before)
99+
* a certain File (whose last modification time will be used as reference).
96100
*
97101
* @param cutoffReference the file whose last modification
98102
* time is usesd as the threshold age of the files
@@ -108,7 +112,8 @@ public AgeFileFilter(File cutoffReference) {
108112
*
109113
* @param cutoffReference the file whose last modification
110114
* time is usesd as the threshold age of the files
111-
* @param acceptOlder if true, older files are accepted, else newer ones
115+
* @param acceptOlder if true, older files (at or before the cutoff)
116+
* are accepted, else newer ones (after the cutoff).
112117
*/
113118
public AgeFileFilter(File cutoffReference, boolean acceptOlder) {
114119
this(cutoffReference.lastModified(), acceptOlder);
@@ -118,7 +123,11 @@ public AgeFileFilter(File cutoffReference, boolean acceptOlder) {
118123
/**
119124
* Checks to see if the last modification of the file matches cutoff
120125
* favorably.
121-
* If last modification time equals cutoff, file is not selected.
126+
* <p>
127+
* If last modification time equals cutoff and newer files are required,
128+
* file <b>IS NOT</b> selected.
129+
* If last modification time equals cutoff and older files are required,
130+
* file <b>IS</b> selected.
122131
*
123132
* @param file the File to check
124133
* @return true if the filename matches

src/java/org/apache/commons/io/filefilter/SizeFileFilter.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
import java.io.File;
2020

2121
/**
22-
* Filters files based on size, can filter either larger or smaller files
23-
* as compared to a given threshold.
22+
* Filters files based on size, can filter either smaller files or
23+
* files equal to or larger than a given threshold.
2424
* <p>
2525
* For example, to print all files and directories in the
2626
* current directory whose size is greater than 1 MB:
@@ -45,7 +45,8 @@ public class SizeFileFilter extends AbstractFileFilter {
4545
private boolean acceptLarger;
4646

4747
/**
48-
* Constructs a new size file filter for files larger than a certain size.
48+
* Constructs a new size file filter for files equal to or
49+
* larger than a certain size.
4950
*
5051
* @param size the threshold size of the files
5152
* @throws IllegalArgumentException if the size is negative
@@ -59,7 +60,8 @@ public SizeFileFilter(long size) {
5960
* threshold.
6061
*
6162
* @param size the threshold size of the files
62-
* @param acceptLarger if true, larger files are accepted, else smaller ones
63+
* @param acceptLarger if true, files equal to or larger are accepted,
64+
* otherwise smaller ones (but not equal to)
6365
* @throws IllegalArgumentException if the size is negative
6466
*/
6567
public SizeFileFilter(long size, boolean acceptLarger) {
@@ -73,7 +75,11 @@ public SizeFileFilter(long size, boolean acceptLarger) {
7375
//-----------------------------------------------------------------------
7476
/**
7577
* Checks to see if the size of the file is favorable.
76-
* If size equals threshold, file is not selected.
78+
* <p>
79+
* If size equals threshold and smaller files are required,
80+
* file <b>IS NOT</b> selected.
81+
* If size equals threshold and larger files are required,
82+
* file <b>IS</b> selected.
7783
*
7884
* @param file the File to check
7985
* @return true if the filename matches

0 commit comments

Comments
 (0)