|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectorg.apache.lenya.search.Grep
public class Grep
Utility class to provide a subset of the grep functionality.
| Constructor Summary | |
|---|---|
Grep()
|
|
| Method Summary | |
|---|---|
static boolean |
containsPattern(java.io.File file,
java.util.regex.Pattern pattern)
Check if the given file contains the pattern |
static java.io.File[] |
find(java.io.File file,
java.lang.String searchString)
Find all files below the given file which contain the given search string. |
static java.lang.String[] |
findPattern(java.io.File file,
java.util.regex.Pattern pattern,
int group)
Find all occurences of pattern in a file. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Grep()
| Method Detail |
|---|
public static boolean containsPattern(java.io.File file,
java.util.regex.Pattern pattern)
throws java.io.IOException
file - the file which is to be searched for the patternpattern - the pattern that is being searched.
java.io.IOException
public static java.lang.String[] findPattern(java.io.File file,
java.util.regex.Pattern pattern,
int group)
throws java.io.IOException
file - the file to search for occurences of patternpattern - the pattern to search forgroup - which group in the pattern to return
array of occurences of pattern
(i.e. the groupth group of the match)
java.io.IOException - if the file could not be read.
public static java.io.File[] find(java.io.File file,
java.lang.String searchString)
throws java.io.IOException
file - the where to start the searchsearchString - the string to search for.
java.io.IOException - if any of the files could not be opened.
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||