|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectmisc.LineReader
Small class demostrating the use of the java.io.LineNumberReader class
and it's usefulness in searching text files.
TODO At some point consider the following enhancements
| Nested Class Summary | |
class |
LineReader.RetList
Use a public inner class as the return for the searching. |
| Field Summary | |
private static boolean |
bCommandLine
true when called the class is used via a command line |
(package private) java.util.List |
fileList
A list of files to process |
(package private) java.lang.String |
strSearchText
The text to search for in the file |
| Constructor Summary | |
LineReader(java.lang.String[] args)
Constructor that processes the command line arguments The minimum number of args is 2. |
|
| Method Summary | |
static void |
main(java.lang.String[] args)
Main function - runs the show |
private java.util.List |
search(java.lang.String fileName,
java.io.LineNumberReader lnr)
Get hold of each line and search it for the first instance of the search string |
java.util.List |
searchFiles()
Search the file list a line at a time for the search string |
private void |
usage()
Display the usage details for this class - if called from the command line |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private static boolean bCommandLine
java.lang.String strSearchText
java.util.List fileList
| Constructor Detail |
public LineReader(java.lang.String[] args)
| Method Detail |
public static void main(java.lang.String[] args)
public java.util.List searchFiles()
private java.util.List search(java.lang.String fileName,
java.io.LineNumberReader lnr)
throws java.io.IOException
java.io.IOExceptionprivate void usage()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||