public class TokenFilter extends BaseFilterReader implements ChainableReader
BaseFilterReader
,
ChainableReader
,
DynamicConfigurator
Modifier and Type | Class and Description |
---|---|
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
|
Constructor and Description |
---|
TokenFilter()
Constructor for "dummy" instances.
|
TokenFilter(java.io.Reader in)
Creates a new filtered reader.
|
Modifier and Type | Method and Description |
---|---|
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.
|
getInitialized, getProject, read, readFully, readLine, setInitialized, setProject, skip
public TokenFilter()
BaseFilterReader.BaseFilterReader()
public TokenFilter(java.io.Reader in)
in
- A Reader object providing the underlying stream.
Must not be null
.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 final java.io.Reader chain(java.io.Reader reader)
chain
in interface ChainableReader
reader
- A Reader object providing the underlying stream.public void setDelimOutput(java.lang.String delimOutput)
delimOutput
- replaces the delim string returned by the
tokenizer, if present.public void addLineTokenizer(LineTokenizer tokenizer)
tokenizer
- the line tokenizerpublic void addStringTokenizer(TokenFilter.StringTokenizer tokenizer)
tokenizer
- the string tokenizerpublic void addFileTokenizer(TokenFilter.FileTokenizer tokenizer)
tokenizer
- the file tokenizerpublic void add(Tokenizer tokenizer)
tokenizer
- the tokenizer to all, only one allowedpublic void addReplaceString(TokenFilter.ReplaceString filter)
filter
- the replace string filterpublic void addContainsString(TokenFilter.ContainsString filter)
filter
- the contains string filterpublic void addReplaceRegex(TokenFilter.ReplaceRegex filter)
filter
- the replace regex filterpublic void addContainsRegex(TokenFilter.ContainsRegex filter)
filter
- the contains regex filterpublic void addTrim(TokenFilter.Trim filter)
filter
- the trim filterpublic void addIgnoreBlank(TokenFilter.IgnoreBlank filter)
filter
- the ignore blank filterpublic void addDeleteCharacters(TokenFilter.DeleteCharacters filter)
filter
- the delete characters filterpublic void add(TokenFilter.Filter filter)
filter
- the filter to addpublic static java.lang.String resolveBackSlash(java.lang.String input)
input
- raw string with possible embedded '\'spublic static int convertRegexOptions(java.lang.String flags)
flags
- the string containing the flags