|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mindprod.commandline.CommandLine
public final class CommandLine
Process the command line passed to main to find all the files and directories mentioned on it.
They have he form: file.txt \mydir aRelativedir/subdir *.* The -s option means, include subdirectories of any mentioned directories thereafter everything is relative to the current directory, not to what preceeded on the line. The -q (quiet) option means suppress listing of file processed.
Field Summary | |
---|---|
static java.lang.String |
VERSION_STRING
embedded version string. |
Constructor Summary | |
---|---|
CommandLine(java.lang.String[] args,
java.io.FilenameFilter dirFilter,
java.io.FilenameFilter fileFilter)
constructor. |
Method Summary | |
---|---|
boolean |
isQuiet()
Return true if should suppress some output. |
java.util.Iterator<java.io.File> |
iterator()
iterator over all files mentioned on the command line, expanded |
static void |
main(java.lang.String[] args)
TEST harness. |
int |
size()
how many files hawe been collected? |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String VERSION_STRING
Constructor Detail |
---|
public CommandLine(java.lang.String[] args, java.io.FilenameFilter dirFilter, java.io.FilenameFilter fileFilter)
args
- arguments as they were passed to main, or any similar array of strings. Directory names,
file names, "*.*", -s, -q, result of command line expansion of wildcards to indivdual
files. Any null or empty args will be ignored. This allows you to process some args yourself
then nullify them so CommandLine will ignore them.dirFilter
- a FileFilter to weed out any directories you don't want. It's accept method should return
true for good directories. It should accept directories and reject files. No file will be
accepted unless the directory it in is passes this muster.fileFilter
- FilenameFilter to weed out files you don't want. It's accept method should return true for
any files you want. It should accept files and reject directories. No file will be accepted
unless it passes this muster, even if specifically named.
single filenames, directory names, dot, dot dot. If you use wildcards such as *.* a*.*
abc?.html they expanded BY THE JAVA RUNTIME, to a list of directories and files. This is
rarely what you want. *.* is effectively a one deep recursion into all directories, even
without -s!! "*.*" however, will be treated like . The problem is, CommandLine can't tell
apart a list of directories and files you want processed, from one Windows expanded from *.*
or h*.*. Using an extension, on your wildcard e.g. *.html will tend to keep directories out.
It then returns the files in the form of an Iterator to feed you the File objects, (not the
File names), one by one. -s does subdirs as well for rest of dirs on line.Method Detail |
---|
public boolean isQuiet()
public java.util.Iterator<java.io.File> iterator()
iterator
in interface java.lang.Iterable<java.io.File>
public int size()
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 |