|
|||||||||||
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.SizeFileFilter
Filters files based on size, can filter either larger or smaller files as compared to a given threshold.
For example, to print all files and directories in the current directory whose size is greater than 1 MB:
File dir = new File("."); String[] files = dir.list( new SizeFileFilter(1024 * 1024) ); for ( int i = 0; i < files.length; i++ ) { System.out.println(files[i]); }
Field Summary | |
private boolean |
acceptLarger
Whether the files accepted will be larger or smaller. |
private long |
size
The size threshold. |
Constructor Summary | |
SizeFileFilter(long size)
Constructs a new size file filter for files 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(java.io.File file)
Checks to see if the size of the file is favorable. |
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 size
private boolean acceptLarger
Constructor Detail |
public SizeFileFilter(long size)
size
- the threshold size of the files
java.lang.IllegalArgumentException
- if the size is negativepublic SizeFileFilter(long size, boolean acceptLarger)
size
- the threshold size of the filesacceptLarger
- if true, larger files are accepted, else smaller ones
java.lang.IllegalArgumentException
- if the size is negativeMethod Detail |
public boolean accept(java.io.File file)
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 |