Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.mindprod.filter
Class FileLengthFilter

    java.lang.Object
      com.mindprod.filter.FileLengthFilter

All Implemented Interfaces:
  java.io.FilenameFilter

    public final class FileLengthFilter

extends java.lang.Object
implements java.io.FilenameFilter

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 );

Since:
  2003
Version:
  2.5 2009-02-28 - CommandLine split off in its own package.
Author:
  Roedy Green, Canadian Mind Products

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

### DEBUGGING

    public static final boolean DEBUGGING

  true if debugging. Enables debugging harness.

  See Also:
    Constant Field Values

### LONG_FILES

    public static boolean LONG_FILES

  convenience constant to remember that true means you want long files.

### SHORT_FILES

    public static boolean SHORT_FILES

  convenience constant to help you remember that false means accept short files.

Constructor Detail

### FileLengthFilter

    public FileLengthFilter(long length,
                            boolean wantLongFiles)

  constructor

  Parameters:
    `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

### accept

    public boolean accept(java.io.File dir,
                          java.lang.String name)

  Select only files with appropriate length.

  Specified by:
    `accept` in interface `java.io.FilenameFilter`
  Parameters:
    `dir` - the directory in which the file was found.
    `name` - the name of the file
  Returns:
    true if and only if the name should be included in the file list; false otherwise.

### main

    public static void main(java.lang.String[] args)

  TEST harness

  Parameters:
    `args` - not used

Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD