<linecontains> <contains value="foo"> <contains value="bar"> </linecontains>Or:
<filterreader classname="org.apache.tools.ant.filters.LineContains"> <param type="contains" value="foo"/> <param type="contains" value="bar"/> </filterreader>This will include only those lines that contain
foo and
bar.
Starting Ant 1.10.4, the matchAny attribute can be used to control whether any one
of the user-specified strings is expected to be contained in the line or all
of them are expected to be contained.
For example:
<linecontains matchAny="true"> * <contains value="foo"> * <contains value="bar"> * </linecontains>This will include only those lines that contain either
foo or bar.
| Modifier and Type | Class and Description |
|---|---|
| public static class | LineContains.Contains
Holds a contains element |
| Modifier and Type | Field and Description |
|---|---|
| private Vector | contains
Vector that holds the strings that input lines must contain. |
| private static final String | CONTAINS_KEY
Parameter name for the words to filter on. |
| private String | line
Remaining line to be read from this filter, or |
| private boolean | |
| private boolean | |
| private static final String | NEGATE_KEY
Parameter name for the words to filter on. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | LineContains(final Reader
A Reader object providing the underlying stream.
Must not be in)null.Creates a new filtered reader. |
| Modifier and Type | Method and Description |
|---|---|
| public void | addConfiguredContains(final LineContains.
The containscontains element to add.
Must not be null.Adds a |
| public Reader | Returns: a new filter based on this configuration, but filtering the specified readerA Reader object providing the underlying stream.
Must not be rdr)null.Implements org. |
| private Vector | Returns: the vector of words which must be contained within a line read from the original stream in order for it to match this filter. The returned object is "live" - in other words, changes made to the returned object are mirrored in the filter.Returns the vector of words which must be contained within a line read from the original stream in order for it to match this filter. |
| private void | |
| public boolean | Returns: Returns true if thisLineContains is considered a match,
if any of the contains value match. False
if all of the contains value are expected
to match
|
| public boolean | |
| public int | Returns: the next character in the resulting stream, or -1 if the end of the resulting stream has been reachedOverrides java. |
| private void | setContains(final Vector<String>
A vector of words which must be contained within a line
in order for it to match in this filter. Must not be contains)null.Sets the vector of words which must be contained within a line read from the original stream in order for it to match this filter. |
| public void | setMatchAny(final boolean
True if this matchAny)LineContains is considered a match,
if any of the contains value match. False
if all of the contains value are expected
to match
|
| public void |
| contains | back to summary |
|---|---|
| private Vector<String> contains Vector that holds the strings that input lines must contain. | |
| CONTAINS_KEY | back to summary |
|---|---|
| private static final String CONTAINS_KEY Parameter name for the words to filter on. | |
| line | back to summary |
|---|---|
| private String line Remaining line to be read from this filter, or | |
| matchAny | back to summary |
|---|---|
| private boolean matchAny | |
| negate | back to summary |
|---|---|
| private boolean negate | |
| NEGATE_KEY | back to summary |
|---|---|
| private static final String NEGATE_KEY Parameter name for the words to filter on. | |
| LineContains | back to summary |
|---|---|
| public LineContains() Constructor for "dummy" instances.
| |
| LineContains | back to summary |
|---|---|
| public LineContains(final Reader in) Creates a new filtered reader.
| |
| addConfiguredContains | back to summary |
|---|---|
| public void addConfiguredContains(final LineContains. Adds a
| |
| chain | back to summary |
|---|---|
| public Reader chain(final Reader rdr) Implements org. Creates a new LineContains using the passed in Reader for instantiation. | |
| getContains | back to summary |
|---|---|
| private Vector Returns the vector of words which must be contained within a line read from the original stream in order for it to match this filter. | |
| initialize | back to summary |
|---|---|
| private void initialize() Parses the parameters to add user-defined contains strings. | |
| isMatchAny | back to summary |
|---|---|
public boolean isMatchAny()
| |
| isNegated | back to summary |
|---|---|
| public boolean isNegated() Find out whether we have been negated.
| |
| read | back to summary |
|---|---|
| public int read() throws IOException Overrides java. Returns the next character in the filtered stream, only including lines from the original stream which contain all of the specified words.
| |
| setContains | back to summary |
|---|---|
| private void setContains(final Vector<String> contains) Sets the vector of words which must be contained within a line read from the original stream in order for it to match this filter. | |
| setMatchAny | back to summary |
|---|---|
public void setMatchAny(final boolean matchAny)
| |
| setNegate | back to summary |
|---|---|
| public void setNegate(boolean b) Set the negation mode. Default false (no negation).
| |
| Modifier and Type | Field and Description |
|---|---|
| private String | value
User defined contains string |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public final String | |
| public final void |
| value | back to summary |
|---|---|
| private String value User defined contains string | |
| Contains | back to summary |
|---|---|
| public Contains() | |
| getValue | back to summary |
|---|---|
| public final String getValue() Returns the contains string.
| |
| setValue | back to summary |
|---|---|
| public final void setValue(String contains) Sets the contains string
| |