org.oddjob.io
Class GrepJob
java.lang.Object
org.oddjob.io.GrepJob
- All Implemented Interfaces:
- Callable<Integer>
public class GrepJob
- extends Object
- implements Callable<Integer>
Description
Search files or an input stream for lines containing
a text value or matches for a regular expression.Example
Search a buffer of text for the word red. In this example the
search is case insensitive and the results a written to the console
with the line number.
<oddjob>
<job>
<grep ignoreCase="true" lineNumbers="true" text="red">
<in>
<buffer>5 green cars.
2 red buses.
1 RED lorry.
</buffer>
</in>
<out>
<stdout/>
</out>
</grep>
</job>
</oddjob>
- Author:
- rob
GrepJob
public GrepJob()
call
public Integer call()
throws IOException
- Specified by:
call
in interface Callable<Integer>
- Throws:
IOException
getName
public String getName()
setName
public void setName(String name)
getFiles
public File[] getFiles()
setFiles
public void setFiles(File[] files)
getIn
public InputStream getIn()
setIn
public void setIn(InputStream in)
getText
public String getText()
setText
public void setText(String text)
getRegexp
public String getRegexp()
setRegexp
public void setRegexp(String regexp)
getOut
public OutputStream getOut()
setOut
public void setOut(OutputStream out)
getResults
public Collection<? super GrepLineResult> getResults()
setResults
public void setResults(Collection<? super GrepLineResult> results)
getMatchedLineCount
public int getMatchedLineCount()
isLineNumbers
public boolean isLineNumbers()
setLineNumbers
public void setLineNumbers(boolean lineNumbers)
isNoPath
public boolean isNoPath()
setNoPath
public void setNoPath(boolean noPath)
isNoFilename
public boolean isNoFilename()
setNoFilename
public void setNoFilename(boolean noFileName)
isWithFilename
public boolean isWithFilename()
setWithFilename
public void setWithFilename(boolean withFilename)
isIgnoreCase
public boolean isIgnoreCase()
setIgnoreCase
public void setIgnoreCase(boolean ignoreCase)
isInvert
public boolean isInvert()
setInvert
public void setInvert(boolean invert)
toString
public String toString()
- Overrides:
toString
in class Object