|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jmw.tzap.AbstractFilter com.jmw.tzap.IteratingFilter com.jmw.tzap.filters.ReplaceFilter
public class ReplaceFilter
Replaces a regular expression in a buffer.
Field Summary | |
---|---|
protected int |
count
|
protected int |
fileCount
|
protected java.lang.String |
regex
|
protected boolean |
replaceFirst
|
protected java.lang.String |
replacement
|
Fields inherited from class com.jmw.tzap.AbstractFilter |
---|
encoding, MSG_DEBUG, MSG_ERR, MSG_INFO, MSG_VERBOSE, MSG_WARN, task |
Constructor Summary | |
---|---|
ReplaceFilter()
|
Method Summary | |
---|---|
java.lang.StringBuffer |
doFilter(java.lang.StringBuffer sb,
java.lang.String fileName)
Does the actual filtering. |
void |
setFirstOnly(boolean first)
Sets the repalce first only flag. |
void |
setRegex(java.lang.String regexp)
Sets the regular expression to be replaced. |
void |
setReplacement(java.lang.String replacement)
Sets the replacment value. |
void |
unload()
Does any clean up after the filter has been finished. |
void |
validateParameters()
Validates any parameters needed by the child filters. |
Methods inherited from class com.jmw.tzap.IteratingFilter |
---|
execute, load |
Methods inherited from class com.jmw.tzap.AbstractFilter |
---|
getName, log, log, setEncoding, setTask |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.String regex
protected java.lang.String replacement
protected int count
protected int fileCount
protected boolean replaceFirst
Constructor Detail |
---|
public ReplaceFilter()
Method Detail |
---|
public void unload()
AbstractFilter
unload
in class IteratingFilter
public java.lang.StringBuffer doFilter(java.lang.StringBuffer sb, java.lang.String fileName)
IteratingFilter
doFilter
in class IteratingFilter
sb
- the file to be filtered as a StringBufferfileName
- the name that this file is called on disk
public void validateParameters() throws java.lang.Exception
AbstractFilter
validateParameters
in class AbstractFilter
java.lang.Exception
public void setRegex(java.lang.String regexp)
regexp
- the regular expressionpublic void setReplacement(java.lang.String replacement)
replacment
- the string to replace the regex withpublic void setFirstOnly(boolean first)
first
- the flag value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |