@@ -0,0 +1,1860 @@
+package rand.strat;%0A%0Aimport java.util.Arrays;%0Aimport rand.ByteStream;%0Aimport rand.StreamStrategy;%0A%0A/**%0A * A strategy that selectively applies a delegate strategy based on a set%0A * filter.%0A */%0Apublic class FilterStrategy implements StreamStrategy %7B%0A    private final StreamStrategy strategy;%0A    private final byte%5B%5D match;%0A    private final byte%5B%5D mask;%0A    private final boolean skip;%0A    %0A    /**%0A     * Constructs a new FilterStrategy that filters bytes if they match the%0A     * given pattern after applying the given bit mask.%0A     * %0A     * @param strategy The delegate strategy to use.%0A     * @param match The matching byte pattern to filter.%0A     * @param mask The bit mask to apply to bytes read from the stream.%0A     * @param skip true if matching bytes should be skipped; false if only %0A     * matching bytes should be executed on.%0A     */%0A    public FilterStrategy(StreamStrategy strategy, byte%5B%5D match, byte%5B%5D mask,%0A            boolean skip) %7B%0A        if (match.length != mask.length) %7B%0A            throw new IllegalArgumentException(%22Match and mask byte arrays must%22%0A                    + %22 have the same length.%22);%0A        %7D%0A        %0A        this.strategy = strategy;%0A        this.match = match.clone();%0A        this.mask = mask.clone();%0A        this.skip = skip;%0A    %7D%0A    %0A    /**%0A     * Filters the given byte stream.%0A     * %0A     * @param stream The byte stream to execute on.%0A     */%0A    @Override%0A    public void execute(ByteStream stream) %7B%0A        byte%5B%5D temp = stream.readBytes(this.match.length);%0A        %0A        // Apply bit mask.%0A        for (int i = 0; i %3C this.mask.length; i++) %7B%0A            temp%5Bi%5D &= this.mask%5Bi%5D;%0A        %7D%0A        boolean matched = Arrays.equals(temp, match);%0A        %0A        if (matched != skip) %7B%0A            stream.advance(-this.match.length);%0A            this.strategy.execute(stream);%0A        %7D%0A    %7D%0A%7D%0A

Add FilterStrategy to be used for Mystery Data.