|
terp - the ANT Tasks v1.3.304 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.Reader
java.io.FilterReader
org.apache.tools.ant.filters.BaseFilterReader
org.apache.tools.ant.filters.BaseParamFilterReader
com.codemesh.terp.ant.ReplacePatternFilter
public class ReplacePatternFilter
A filter that replaces certain patterns in a file when applied to it. This filter is subclassed to provide specific services like stripping leading copyright notices or file history comments. A stripping filter is simply a replacement filter that replaces the search pattern with nothing. Please make sure to enclose the search pattern(s) in capturing group markers. This filter allows you to search for a complex pattern and only replace parts of it with the specified replacements, but in exchange for this feature, it requires you to enclose the entire pattern in a cpaturing group if you indeed want to replace the entire pattern.
| Nested Class Summary | |
|---|---|
static class |
ReplacePatternFilter.StringValue
|
| Field Summary | |
|---|---|
static java.lang.String |
PATTERN_KEY
|
static java.lang.String |
POSITION_KEY
|
static java.lang.String |
REPEAT_KEY
|
static java.lang.String |
REPLACEMENT_KEY
|
| Fields inherited from class java.io.FilterReader |
|---|
in |
| Fields inherited from class java.io.Reader |
|---|
lock |
| Constructor Summary | |
|---|---|
ReplacePatternFilter()
|
|
ReplacePatternFilter(java.io.Reader in)
Creates a new filtered reader. |
|
| Method Summary | |
|---|---|
java.io.Reader |
chain(java.io.Reader rdr)
|
ReplacePatternFilter.StringValue |
createReplacement()
|
java.lang.String |
getPattern()
Returns the search pattern's string representation. |
java.lang.String |
getPosition()
Returns the starting position for replacements. |
java.lang.String |
getRepeat()
Returns the number of repetitions for the replacement action. |
protected void |
initialize()
Scans the parameters list for the known parameters. |
int |
read()
|
protected void |
replace(java.io.Reader rdr)
|
void |
setPattern(java.lang.String pattern)
Sets the search pattern as a Java regular expression. |
void |
setPosition(java.lang.String position)
Sets the starting position for replacements. |
void |
setRepeat(java.lang.String repeat)
Sets the number of repetitions for the replacement action. |
| Methods inherited from class org.apache.tools.ant.filters.BaseParamFilterReader |
|---|
getParameters, setParameters |
| Methods inherited from class org.apache.tools.ant.filters.BaseFilterReader |
|---|
getInitialized, getProject, read, readFully, readLine, setInitialized, setProject, skip |
| Methods inherited from class java.io.FilterReader |
|---|
close, mark, markSupported, ready, reset |
| Methods inherited from class java.io.Reader |
|---|
read, read |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String PATTERN_KEY
public static final java.lang.String POSITION_KEY
public static final java.lang.String REPEAT_KEY
public static final java.lang.String REPLACEMENT_KEY
| Constructor Detail |
|---|
public ReplacePatternFilter()
public ReplacePatternFilter(java.io.Reader in)
in - A Reader object providing the underlying stream.
Must not be null.| Method Detail |
|---|
public java.lang.String getPattern()
public void setPattern(java.lang.String pattern)
pattern - the regular expression pattern.public java.lang.String getPosition()
public void setPosition(java.lang.String position)
position - the starting position.public java.lang.String getRepeat()
public void setRepeat(java.lang.String repeat)
repeat - the number of repetitions.public ReplacePatternFilter.StringValue createReplacement()
public int read()
throws java.io.IOException
read in class java.io.FilterReaderjava.io.IOExceptionpublic java.io.Reader chain(java.io.Reader rdr)
chain in interface org.apache.tools.ant.filters.ChainableReaderprotected void replace(java.io.Reader rdr)
protected void initialize()
|
terp - the ANT Tasks v1.3.304 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||