|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mindprod.filter.FilenameLengthFilter
public final class FilenameLengthFilter
Filter accepting only short or long filenames (not files).
See FileLengthFilter for short or long files. filename used to check the length is File.getName() without path stuff e.g. "thing.html" Use it like this to get a list of file names shorter than 4 characters. FilenameFilter f = new FilenameLengthFilter( 4, false ); String[] filenames = new File( "MyDir" ).list( f );
Field Summary | |
---|---|
static boolean |
DEBUGGING
true if debugging. |
static boolean |
LONG_FILENAMES
convenience constant to remember that true means you want long filenames. |
static boolean |
SHORT_FILENAMES
convenience constant to help you remember that false means accept short names. |
Constructor Summary | |
---|---|
FilenameLengthFilter(int desiredLength,
boolean wantLongNames)
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 final boolean LONG_FILENAMES
public static final boolean SHORT_FILENAMES
Constructor Detail |
---|
public FilenameLengthFilter(int desiredLength, boolean wantLongNames)
desiredLength
- The length of filename you want to accept.wantLongNames
- true LONG_FILENAMES if you want filenames longer or equal to the specified length. false
SHORT_FILENAMES 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 |