org.oddjob.io
Class GrepJob

java.lang.Object
  extended by 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

Constructor Summary
GrepJob()
           
 
Method Summary
 Integer call()
           
 File[] getFiles()
           
 InputStream getIn()
           
 int getMatchedLineCount()
           
 String getName()
           
 OutputStream getOut()
           
 String getRegexp()
           
 Collection<? super GrepLineResult> getResults()
           
 String getText()
           
 boolean isIgnoreCase()
           
 boolean isInvert()
           
 boolean isLineNumbers()
           
 boolean isNoFilename()
           
 boolean isNoPath()
           
 boolean isWithFilename()
           
 void setFiles(File[] files)
           
 void setIgnoreCase(boolean ignoreCase)
           
 void setIn(InputStream in)
           
 void setInvert(boolean invert)
           
 void setLineNumbers(boolean lineNumbers)
           
 void setName(String name)
           
 void setNoFilename(boolean noFileName)
           
 void setNoPath(boolean noPath)
           
 void setOut(OutputStream out)
           
 void setRegexp(String regexp)
           
 void setResults(Collection<? super GrepLineResult> results)
           
 void setText(String text)
           
 void setWithFilename(boolean withFilename)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GrepJob

public GrepJob()
Method Detail

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