import java.io.*; abstract public class PatternFilter extends FilterReader { public PatternFilter(Reader r) { super(r); } abstract protected void test() throws IOException; public int read() throws IOException { // Look ahead in the input stream for a match -- // method test() should throw an exception is one // one is found... test(); return in.read(); } }