Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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:
  java.io.Closeable, java.lang.Readable, ChainableReader

    public class TokenFilter

extends BaseFilterReader
implements ChainableReader

This splits up input into tokens and passes the tokens to a sequence of filters.

Since:
  Ant 1.6
See Also:
  `BaseFilterReader`, `ChainableReader`, `DynamicConfigurator`

Nested Class Summary
`static class` | `TokenFilter.ChainableReaderFilter` Abstract class that converts derived filter classes into ChainableReaderFilter's
`static class` | `TokenFilter.ContainsRegex` filter to filter tokens matching regular expressions.
`static class` | `TokenFilter.ContainsString` Simple filter to filter lines contains strings
`static class` | `TokenFilter.DeleteCharacters` Filter to delete characters
`static class` | `TokenFilter.FileTokenizer` class to read the complete input into a string
`static interface` | `TokenFilter.Filter` string filters implement this interface
`static class` | `TokenFilter.IgnoreBlank` Filter remove empty tokens
`static class` | `TokenFilter.ReplaceRegex` filter to replace regex.
`static class` | `TokenFilter.ReplaceString` Simple replace string filter.
`static class` | `TokenFilter.StringTokenizer` class to tokenize the input as areas separated by white space, or by a specified list of delim characters.
`static class` | `TokenFilter.Trim` Filter to trim white space

Field Summary

Fields inherited from class java.io.FilterReader
`in`

Fields inherited from class java.io.Reader
`lock`

Constructor Summary
`TokenFilter()` Constructor for "dummy" instances.
`TokenFilter(java.io.Reader in)` Creates a new filtered reader.

Method Summary
`void` | `add(TokenFilter.Filter filter)` Add an arbitrary filter
`void` | `add(Tokenizer tokenizer)` add an arbitrary tokenizer
`void` | `addContainsRegex(TokenFilter.ContainsRegex filter)` contains regex filter
`void` | `addContainsString(TokenFilter.ContainsString filter)` contains string filter
`void` | `addDeleteCharacters(TokenFilter.DeleteCharacters filter)` delete chars
`void` | `addFileTokenizer(TokenFilter.FileTokenizer tokenizer)` add a file tokenizer
`void` | `addIgnoreBlank(TokenFilter.IgnoreBlank filter)` ignore blank filter
`void` | `addLineTokenizer(LineTokenizer tokenizer)` add a line tokenizer - this is the default.
`void` | `addReplaceRegex(TokenFilter.ReplaceRegex filter)` replace regex filter
`void` | `addReplaceString(TokenFilter.ReplaceString filter)` replace string filter
`void` | `addStringTokenizer(TokenFilter.StringTokenizer tokenizer)` add a string tokenizer
`void` | `addTrim(TokenFilter.Trim filter)` trim filter
`java.io.Reader` | `chain(java.io.Reader reader)` Creates a new TokenFilter using the passed in Reader for instantiation.
`static int` | `convertRegexOptions(java.lang.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_SINGLELINE
`int` | `read()` Returns the next character in the filtered stream, only including lines from the original stream which match all of the specified regular expressions.
`static java.lang.String` | `resolveBackSlash(java.lang.String input)` xml does not do "c" like interpretation of strings.
`void` | `setDelimOutput(java.lang.String delimOutput)` set the output delimiter.

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

### TokenFilter

    public TokenFilter()

  Constructor for "dummy" instances.

  See Also:
    `BaseFilterReader.BaseFilterReader()`

### TokenFilter

    public TokenFilter(java.io.Reader in)

  Creates a new filtered reader.

  Parameters:
    `in` - A Reader object providing the underlying stream. Must not be `null`.

Method Detail

### read

    public int read()
             throws java.io.IOException

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

  Overrides:
    `read` in class `java.io.FilterReader`
  Returns:
    the next character in the resulting stream, or -1 if the end of the resulting stream has been reached
  Throws:
    `java.io.IOException` - if the underlying stream throws an IOException during reading

### chain

    public final java.io.Reader chain(java.io.Reader reader)

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

  Specified by:
    `chain` in interface `ChainableReader`
  Parameters:
    `reader` - A Reader object providing the underlying stream.
  Returns:
    a new filter based on this configuration

### setDelimOutput

    public void setDelimOutput(java.lang.String delimOutput)

  set the output delimiter.

  Parameters:
    `delimOutput` - replaces the delim string returned by the tokenizer, if present.

### addLineTokenizer

    public void addLineTokenizer(LineTokenizer tokenizer)

  add a line tokenizer - this is the default.

  Parameters:
    `tokenizer` - the line tokenizer

### addStringTokenizer

    public void addStringTokenizer(TokenFilter.StringTokenizer tokenizer)

  add a string tokenizer

  Parameters:
    `tokenizer` - the string tokenizer

### addFileTokenizer

    public void addFileTokenizer(TokenFilter.FileTokenizer tokenizer)

  add a file tokenizer

  Parameters:
    `tokenizer` - the file tokenizer

### add

    public void add(Tokenizer tokenizer)

  add an arbitrary tokenizer

  Parameters:
    `tokenizer` - the tokenizer to all, only one allowed

### addReplaceString

    public void addReplaceString(TokenFilter.ReplaceString filter)

  replace string filter

  Parameters:
    `filter` - the replace string filter

### addContainsString

    public void addContainsString(TokenFilter.ContainsString filter)

  contains string filter

  Parameters:
    `filter` - the contains string filter

### addReplaceRegex

    public void addReplaceRegex(TokenFilter.ReplaceRegex filter)

  replace regex filter

  Parameters:
    `filter` - the replace regex filter

### addContainsRegex

    public void addContainsRegex(TokenFilter.ContainsRegex filter)

  contains regex filter

  Parameters:
    `filter` - the contains regex filter

### addTrim

    public void addTrim(TokenFilter.Trim filter)

  trim filter

  Parameters:
    `filter` - the trim filter

### addIgnoreBlank

    public void addIgnoreBlank(TokenFilter.IgnoreBlank filter)

  ignore blank filter

  Parameters:
    `filter` - the ignore blank filter

### addDeleteCharacters

    public void addDeleteCharacters(TokenFilter.DeleteCharacters filter)

  delete chars

  Parameters:
    `filter` - the delete characters filter

### add

    public void add(TokenFilter.Filter filter)

  Add an arbitrary filter

  Parameters:
    `filter` - the filter to add

### resolveBackSlash

    public static java.lang.String resolveBackSlash(java.lang.String input)

  xml does not do "c" like interpretation of strings. i.e. \n\r\t etc. this method processes \n, \r, \t, \f, \\ also subs \s -> " \n\r\t\f" a trailing '\' will be ignored

  Parameters:
    `input` - raw string with possible embedded '\'s
  Returns:
    converted string

### convertRegexOptions

    public static int convertRegexOptions(java.lang.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_SINGLELINE

  Parameters:
    `flags` - the string containing the flags
  Returns:
    the Regexp option bits

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD