|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.io.Reader java.io.FilterReader org.apache.tools.ant.filters.BaseFilterReader org.apache.tools.ant.filters.BaseParamFilterReader org.apache.tools.ant.filters.ReplaceTokens
public final class ReplaceTokens
Replaces tokens in the original input with user-supplied values. Example:
<replacetokens begintoken="#" endtoken="#"> <token key="DATE" value="${TODAY}"/> </replacetokens>Or:
<filterreader classname="org.apache.tools.ant.filters.ReplaceTokens"> <param type="tokenchar" name="begintoken" value="#"/> <param type="tokenchar" name="endtoken" value="#"/> <param type="token" name="DATE" value="${TODAY}"/> </filterreader>
Nested Class Summary | |
---|---|
static class |
ReplaceTokens.Token
Holds a token |
Field Summary |
---|
Fields inherited from class java.io.FilterReader |
---|
in |
Fields inherited from class java.io.Reader |
---|
lock |
Constructor Summary | |
---|---|
ReplaceTokens()
Constructor for "dummy" instances. |
|
ReplaceTokens(java.io.Reader in)
Creates a new filtered reader. |
Method Summary | |
---|---|
void |
addConfiguredToken(ReplaceTokens.Token token)
Adds a token element to the map of tokens to replace. |
java.io.Reader |
chain(java.io.Reader rdr)
Creates a new ReplaceTokens using the passed in Reader for instantiation. |
int |
read()
Returns the next character in the filtered stream, replacing tokens from the original stream. |
void |
setBeginToken(char beginToken)
Sets the "begin token" character. |
void |
setEndToken(char endToken)
Sets the "end token" character. |
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 |
Constructor Detail |
---|
public ReplaceTokens()
BaseFilterReader.BaseFilterReader()
public ReplaceTokens(java.io.Reader in)
in
- A Reader object providing the underlying stream.
Must not be null
.Method Detail |
---|
public int read() throws java.io.IOException
read
in class java.io.FilterReader
java.io.IOException
- if the underlying stream throws an IOException
during readingpublic void setBeginToken(char beginToken)
beginToken
- the character used to denote the beginning of a tokenpublic void setEndToken(char endToken)
endToken
- the character used to denote the end of a tokenpublic void addConfiguredToken(ReplaceTokens.Token token)
token
- The token to add to the map of replacements.
Must not be null
.public java.io.Reader chain(java.io.Reader rdr)
chain
in interface ChainableReader
rdr
- A Reader object providing the underlying stream.
Must not be null
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |