private List<Rule> readRules(Reader reader) throws IOException, IllegalArgumentException {
  BufferedReader in=new BufferedReader(reader);
  List<Rule> rules=new ArrayList<Rule>();
  String line;
  while ((line=in.readLine()) != null) {
    if (line.length() == 0) {
      continue;
    }
    line=line.trim();
    char first=line.charAt(0);
    boolean sign=false;
switch (first) {
case '+':
      sign=true;
    break;
case '-':
  sign=false;
break;
case ' ':
case '\n':
case '#':
continue;
default :
throw new IOException("Invalid first character: " + line);
}
String regex=line.substring(1);
if (LOG.isTraceEnabled()) {
LOG.trace("Adding rule [" + regex + "]");
}
Rule rule=createRule(sign,regex);
rules.add(rule);
}
return rules;
}

private List < Rule > readRules ( Reader reader ) throws IOException , IllegalArgumentException { BufferedReader in = new BufferedReader ( reader ) ; List < Rule > rules = new ArrayList < Rule > ( ) ; String line ; while ( ( line = in . readLine ( ) ) != null ) { if ( line . length ( ) == 0 ) { continue ; } line = line . trim ( ) ; char first = line . charAt ( 0 ) ; boolean sign = false ; switch ( first ) { case '+' : sign = true ; break ; case '-' : sign = false ; break ; case ' ' : case '\n' : case '#' : continue ; default : throw new IOException ( "Invalid first character: " + line ) ; } String regex = line . substring ( 1 ) ; if ( LOG . isTraceEnabled ( ) ) { LOG . trace ( "Adding rule [" + regex + "]" ) ; } Rule rule = createRule ( sign , regex ) ; rules . add ( rule ) ; } return rules ; }
read the specified file of rules .
