public class FilterRuleChainPlainParser extends Object
PatternFilterRules and build an according
FilterRuleChain. The rules (include/exclude patterns) are proceeded in the order of their appearance in the
list. # This file contains a filter-chain. Such chain is build of a list of # filter-rules. Each rule starts with a character that determines if an # inclusion (+) or an exclusion (-) is defined. This character must be followed # by a regex pattern. To make it easier for you a simple pre-processing is # performed on the pattern string before it is compiled as # java.util.regex.Pattern: # If the pattern does NOT start with "^" or ".*" the prefix ".*" is # automatically added. If the pattern does NOT end with "$" or ".*" the suffix # ".*" is automatically appended. # The pre-processing should safe you some typing and make it a little easier for # users of the GNU command "grep". # # The filter-rules in the chain are processed in the order of their occurrence. # The first rule that matches makes the decision according to the first # character (+/-). # A list starting with the '#' character indicates a comment and is therefore # ignored. The same applies for empty lines. # 1. rule says that all strings that start with "/doc/" will be accepted: +^/doc/ # 2. rule says that all strings that end ($) with ".pdf" ignoring the case (?i) # of the characters will be rejected: -(?i)\.pdf$ # 3. rule says that all string that start with "/data/" will be accepted: +^/data/ # 4. rule says that all string that end ($) with ".xml" or ".xsl" ignoring the # case (?i) of the characters will be rejected: -(?i)\.(xml|xsl)$ # 5. rule says that everything else is accepted +.*
FilterRuleChainXmlParser| Modifier and Type | Field and Description |
|---|---|
private char |
acceptChar |
private char |
commentChar |
private char |
denyChar |
| Constructor and Description |
|---|
FilterRuleChainPlainParser()
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
char |
getAcceptChar()
This method gets the character used to identify an accept pattern.
|
char |
getCommentChar()
This method gets the character used to identify a comment.
|
char |
getDenyChar()
This method gets the character used to identify a deny pattern.
|
FilterRuleChain<String> |
parse(BufferedReader reader,
boolean defaultResult)
|
FilterRuleChain<String> |
parse(Reader reader,
boolean defaultResult)
|
void |
setAcceptChar(char acceptChar) |
void |
setCommentChar(char commentChar) |
void |
setDenyChar(char denyChar) |
private char acceptChar
getAcceptChar()private char denyChar
getDenyChar()private char commentChar
getCommentChar()public char getAcceptChar()
'+'.public void setAcceptChar(char acceptChar)
acceptChar - the acceptChar to setpublic char getDenyChar()
'-'.public void setDenyChar(char denyChar)
denyChar - the denyChar to setpublic char getCommentChar()
'#'.public void setCommentChar(char commentChar)
commentChar - the commentChar to setpublic FilterRuleChain<String> parse(Reader reader, boolean defaultResult) throws IOException
reader - is where to read from. It will be closed at the end of this method (on success and in an exceptional
state).defaultResult - is the default-result of the chain.IOException - if an I/O error occurred while parsing.public FilterRuleChain<String> parse(BufferedReader reader, boolean defaultResult) throws IOException
reader - is where to read from. It will be closed at the end of this method (on success and in an exceptional
state).defaultResult - is the default-result of the chain.IOException - if an I/O error occurred while parsing.Copyright © 2001–2015 mmm-Team. All rights reserved.