public final class CommandLine
extends java.lang.Object
implements java.lang.Iterable<java.io.File>
Modifier and Type | Field and Description |
---|---|
(package private) java.io.File |
cacheFile
cache where file names are stored
|
static java.lang.String |
EMBEDDED_COPYRIGHT
undisplayed copyright notice
|
(package private) Saver |
saver
where we save the file names for later processing
|
static java.lang.String |
VERSION_STRING
embedded version string.
|
Constructor and Description |
---|
CommandLine(java.lang.String[] args,
java.io.FilenameFilter dirFilter,
java.io.FilenameFilter fileFilter)
constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
isQuiet()
Return true if should suppress some output.
|
boolean |
isVerbose()
Return true if should provide verbose 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()
get count of how many files have been cached.
|
public static final java.lang.String EMBEDDED_COPYRIGHT
public static final java.lang.String VERSION_STRING
java.io.File cacheFile
Saver saver
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.public boolean isQuiet()
public boolean isVerbose()
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.