Top Description Inners Fields Constructors Methods
org.apache.tools.ant.filters

public Class TokenFilter

extends BaseFilterReader
implements ChainableReader
Class Inheritance
All Implemented Interfaces
org.apache.tools.ant.filters.ChainableReader
Imports
java.io.IOException, .Reader, java.util.Vector, org.apache.tools.ant.BuildException, .ProjectComponent, org.apache.tools.ant.types.RegularExpression, .Substitution, org.apache.tools.ant.util.LineTokenizer, .StringUtils, .Tokenizer, org.apache.tools.ant.util.regexp.Regexp, .RegexpUtil

This splits up input into tokens and passes the tokens to a sequence of filters.
Since
Ant 1.6
See Also
BaseFilterReader, ChainableReader, org.apache.tools.ant.DynamicConfigurator

Nested and Inner Type Summary

Modifier and TypeClass and Description
public abstract static class
TokenFilter.ChainableReaderFilter

Abstract class that converts derived filter classes into ChainableReaderFilter's

public static class
TokenFilter.ContainsRegex

filter to filter tokens matching regular expressions.

public static class
TokenFilter.ContainsString

Simple filter to filter lines contains strings

public static class
TokenFilter.DeleteCharacters

Filter to delete characters

public static class
TokenFilter.FileTokenizer

class to read the complete input into a string

public static interface
TokenFilter.Filter

string filters implement this interface

public static class
TokenFilter.IgnoreBlank

Filter remove empty tokens

public static class
TokenFilter.ReplaceRegex

filter to replace regex.

public static class
TokenFilter.ReplaceString

Simple replace string filter.

public static class
TokenFilter.StringTokenizer

class to tokenize the input as areas separated by white space, or by a specified list of delim characters.

public static class
TokenFilter.Trim

Filter to trim white space

Field Summary

Modifier and TypeField and Description
private String
delimOutput

the output token termination

private Vector<TokenFilter.Filter>
filters

string filters

private String
line

the current string token from the input stream

private int
linePos

the position in the current string token

private Tokenizer
tokenizer

the tokenizer to use on the input stream

Constructor Summary

AccessConstructor and Description
public
TokenFilter()

Constructor for "dummy" instances.

public
TokenFilter(final Reader
A Reader object providing the underlying stream. Must not be null.
in
)

Creates a new filtered reader.

Method Summary

Modifier and TypeMethod and Description
public void
add(Tokenizer
the tokenizer to all, only one allowed
tokenizer
)

add an arbitrary tokenizer

public void
add(TokenFilter.Filter
the filter to add
filter
)

Add an arbitrary filter

public void
addContainsRegex(TokenFilter.ContainsRegex
the contains regex filter
filter
)

contains regex filter

public void
addContainsString(TokenFilter.ContainsString
the contains string filter
filter
)

contains string filter

public void
addDeleteCharacters(TokenFilter.DeleteCharacters
the delete characters filter
filter
)

delete chars

public void
addFileTokenizer(TokenFilter.FileTokenizer
the file tokenizer
tokenizer
)

add a file tokenizer

public void
addIgnoreBlank(TokenFilter.IgnoreBlank
the ignore blank filter
filter
)

ignore blank filter

public void
addLineTokenizer(LineTokenizer
the line tokenizer
tokenizer
)

add a line tokenizer - this is the default.

public void
addReplaceRegex(TokenFilter.ReplaceRegex
the replace regex filter
filter
)

replace regex filter

public void
addReplaceString(TokenFilter.ReplaceString
the replace string filter
filter
)

replace string filter

public void
addStringTokenizer(TokenFilter.StringTokenizer
the string tokenizer
tokenizer
)

add a string tokenizer

public void
addTrim(TokenFilter.Trim
the trim filter
filter
)

trim filter

public final Reader

Returns:

a new filter based on this configuration
chain
(final Reader
A Reader object providing the underlying stream.
reader
)

Implements org.apache.tools.ant.filters.ChainableReader.chain.

Creates a new TokenFilter using the passed in Reader for instantiation.
public static int

Returns:

the Regexp option bits
convertRegexOptions
(String
the string containing the flags
flags
)

convert regex option flag characters to regex options

  • g - Regexp.REPLACE_ALL
  • i - Regexp.MATCH_CASE_INSENSITIVE
  • m - Regexp.MATCH_MULTILINE
  • s - Regexp.MATCH_SINGLELINE
public int

Returns:

the next character in the resulting stream, or -1 if the end of the resulting stream has been reached
read
()

Overrides java.io.FilterReader.read.

Returns the next character in the filtered stream, only including lines from the original stream which match all of the specified regular expressions.
public static String

Returns:

converted string
resolveBackSlash
(String
raw string with possible embedded '\'s
input
)

xml does not do "c" like interpretation of strings.

public void
setDelimOutput(String
replaces the delim string returned by the tokenizer, if present.
delimOutput
)

set the output delimiter.

Inherited from org.apache.tools.ant.filters.BaseFilterReader:
getInitializedgetProjectreadreadFullyreadLinesetInitializedsetProjectskip