rat.header
Class HeaderMatcher

java.lang.Object
  extended by rat.header.HeaderMatcher

public class HeaderMatcher
extends java.lang.Object

Matches headers.

Usage:

  1. read(Reader) content
  2. matches(Pattern) against filtered content

Note: use only from a single thread.


Constructor Summary
HeaderMatcher(rat.header.CharFilter filter, int capacity)
           
HeaderMatcher(rat.header.CharFilter filter, int capacity, HeaderBean[] headers)
           
 
Method Summary
 int lines()
          Number of lines read.
 boolean matches(java.util.regex.Pattern pattern)
          Seeks a match in the last headers read.
 void read(java.io.Reader reader)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HeaderMatcher

public HeaderMatcher(rat.header.CharFilter filter,
                     int capacity)

HeaderMatcher

public HeaderMatcher(rat.header.CharFilter filter,
                     int capacity,
                     HeaderBean[] headers)
Method Detail

read

public void read(java.io.Reader reader)
          throws java.io.IOException
Throws:
java.io.IOException

matches

public boolean matches(java.util.regex.Pattern pattern)

Seeks a match in the last headers read.

Note that this pattern must not contain filtered characters.

Parameters:
pattern - Pattern to match
Returns:
true if the pattern matches, false otherwise or if #read() has not been called

lines

public int lines()
Number of lines read.

Returns:
the number of lines in the file or -1 if the file has more lines than were read


Copyright © 2006-2008. All Rights Reserved.