|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mindprod.filter.FileLengthFilter
public final class FileLengthFilter
Filters accepting only short or long files (not filenames).
Use it like this to get a list of files shorter than 12 characters. FilenameFilter f = new FileLengthFilter( 12, false ); String[] filenames = new File ( "MyDir" ).list( f );
Field Summary | |
---|---|
static boolean |
DEBUGGING
true if debugging. |
static boolean |
LONG_FILES
convenience constant to remember that true means you want long files. |
static boolean |
SHORT_FILES
convenience constant to help you remember that false means accept short files. |
Constructor Summary | |
---|---|
FileLengthFilter(long length,
boolean wantLongFiles)
constructor |
Method Summary | |
---|---|
boolean |
accept(java.io.File dir,
java.lang.String name)
Select only files with appropriate length. |
static void |
main(java.lang.String[] args)
TEST harness |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final boolean DEBUGGING
public static boolean LONG_FILES
public static boolean SHORT_FILES
Constructor Detail |
---|
public FileLengthFilter(long length, boolean wantLongFiles)
length
- The length of file you want to accept.wantLongFiles
- true LONG_FILES if you want file longer or equal to the specified length. false SHORT_FILES
if you want filenames shorter or equal to the specified length.Method Detail |
---|
public boolean accept(java.io.File dir, java.lang.String name)
accept
in interface java.io.FilenameFilter
dir
- the directory in which the file was found.name
- the name of the file
public static void main(java.lang.String[] args)
args
- not used
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |