import java.io.*; // invoke 4 different ways: // 1. java TestPart2 10 10 < p5.html > testPart2.out1 // 2. java TestPart2 100 100 < TestPart2.java > testPart2.out2 // 3. java TestPart2 10 100 < p5.html > testPart2.out3 // 4. java TestPart2 100 10 < TestPart2.java > testPart2.out4 // for all cases, the output file should be identical to the input file - // check with diff or cmp public class TestPart2 { static public void main(String args[]) { final InputStreamReader in = new InputStreamReader(System.in); final PrintWriter out = new PrintWriter(System.out, true ); if (args.length != 2) throw new IllegalArgumentException("TestPart2 requires 2 arguments: ReadBufferSize WriteBufferSize"); // try with different buffer sizes int ReadBufSize = Integer.parseInt(args[0]); int WriteBufSize = Integer.parseInt(args[1]); Runnable compute = new PassThrough(); Filter filter = new FilterImpl(in, out, ReadBufSize, WriteBufSize, compute); ( (PassThrough) compute).setFilter(filter); filter.startFilter(); } }