Package org.apache.tools.ant.filters
Class TokenFilter
java.lang.Object
java.io.Reader
java.io.FilterReader
org.apache.tools.ant.filters.BaseFilterReader
org.apache.tools.ant.filters.TokenFilter
- All Implemented Interfaces:
- Closeable,- AutoCloseable,- Readable,- ChainableReader
This splits up input into tokens and passes
 the tokens to a sequence of filters.
- Since:
- Ant 1.6
- See Also:
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classAbstract class that converts derived filter classes into ChainableReaderFilter'sstatic classfilter to filter tokens matching regular expressions.static classSimple filter to filter lines contains stringsstatic classFilter to delete charactersstatic classclass to read the complete input into a stringstatic interfacestring filters implement this interfacestatic classFilter remove empty tokensstatic classfilter to replace regex.static classSimple replace string filter.static classclass to tokenize the input as areas separated by white space, or by a specified list of delim characters.static classFilter to trim white space
- 
Field SummaryFields inherited from class java.io.FilterReaderin
- 
Constructor SummaryConstructorsConstructorDescriptionConstructor for "dummy" instances.TokenFilter(Reader in) Creates a new filtered reader.
- 
Method SummaryModifier and TypeMethodDescriptionvoidadd(TokenFilter.Filter filter) Add an arbitrary filtervoidadd an arbitrary tokenizervoidcontains regex filtervoidcontains string filtervoiddelete charsvoidaddFileTokenizer(TokenFilter.FileTokenizer tokenizer) add a file tokenizervoidignore blank filtervoidaddLineTokenizer(LineTokenizer tokenizer) add a line tokenizer - this is the default.voidreplace regex filtervoidreplace string filtervoidaddStringTokenizer(TokenFilter.StringTokenizer tokenizer) add a string tokenizervoidaddTrim(TokenFilter.Trim filter) trim filterfinal ReaderCreates a new TokenFilter using the passed in Reader for instantiation.static intconvertRegexOptions(String 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_SINGLELINEintread()Returns the next character in the filtered stream, only including lines from the original stream which match all of the specified regular expressions.static StringresolveBackSlash(String input) xml does not do "c" like interpretation of strings.voidsetDelimOutput(String delimOutput) set the output delimiter.Methods inherited from class org.apache.tools.ant.filters.BaseFilterReadergetInitialized, getProject, read, readFully, readLine, setInitialized, setProject, skipMethods inherited from class java.io.FilterReaderclose, mark, markSupported, ready, resetMethods inherited from class java.io.ReadernullReader, read, read, transferTo
- 
Constructor Details- 
TokenFilterpublic TokenFilter()Constructor for "dummy" instances.- See Also:
 
- 
TokenFilterCreates a new filtered reader.- Parameters:
- in- A Reader object providing the underlying stream. Must not be- null.
 
 
- 
- 
Method Details- 
readReturns the next character in the filtered stream, only including lines from the original stream which match all of the specified regular expressions.- Overrides:
- readin class- FilterReader
- Returns:
- the next character in the resulting stream, or -1 if the end of the resulting stream has been reached
- Throws:
- IOException- if the underlying stream throws an IOException during reading
 
- 
chainCreates a new TokenFilter using the passed in Reader for instantiation.- Specified by:
- chainin interface- ChainableReader
- Parameters:
- reader- A Reader object providing the underlying stream.
- Returns:
- a new filter based on this configuration
 
- 
setDelimOutputset the output delimiter.- Parameters:
- delimOutput- replaces the delim string returned by the tokenizer, if present.
 
- 
addLineTokenizeradd a line tokenizer - this is the default.- Parameters:
- tokenizer- the line tokenizer
 
- 
addStringTokenizeradd a string tokenizer- Parameters:
- tokenizer- the string tokenizer
 
- 
addFileTokenizeradd a file tokenizer- Parameters:
- tokenizer- the file tokenizer
 
- 
addadd an arbitrary tokenizer- Parameters:
- tokenizer- the tokenizer to all, only one allowed
 
- 
addReplaceStringreplace string filter- Parameters:
- filter- the replace string filter
 
- 
addContainsStringcontains string filter- Parameters:
- filter- the contains string filter
 
- 
addReplaceRegexreplace regex filter- Parameters:
- filter- the replace regex filter
 
- 
addContainsRegexcontains regex filter- Parameters:
- filter- the contains regex filter
 
- 
addTrimtrim filter- Parameters:
- filter- the trim filter
 
- 
addIgnoreBlankignore blank filter- Parameters:
- filter- the ignore blank filter
 
- 
addDeleteCharactersdelete chars- Parameters:
- filter- the delete characters filter
 
- 
addAdd an arbitrary filter- Parameters:
- filter- the filter to add
 
- 
resolveBackSlashxml does not do "c" like interpretation of strings. i.e. \n\r\t etc. this method processes \n, \r, \t, \f, \\ also subs \s with " \n\r\t\f" a trailing '\' will be ignored- Parameters:
- input- raw string with possible embedded '\'s
- Returns:
- converted string
 
- 
convertRegexOptionsconvert regex option flag characters to regex options- g - Regexp.REPLACE_ALL
- i - Regexp.MATCH_CASE_INSENSITIVE
- m - Regexp.MATCH_MULTILINE
- s - Regexp.MATCH_SINGLELINE
 - Parameters:
- flags- the string containing the flags
- Returns:
- the Regexp option bits
 
 
-