class ResourceNoLongerThanDecideRule extends PredicatedDecideRule {
    private static final long serialVersionUID = -8774160016195991876L;

    private static final Logger logger = Logger.
    	getLogger(ResourceNoLongerThanDecideRule.class.getName());
    
    {
        setUseHeaderLength(true);
    }
    public boolean getUseHeaderLength() {
        return (Boolean) kp.get("useHeaderLength");
    }
    /**
     * Shall this rule be used as a midfetch rule? If true, this rule will
     * determine content length based on HTTP header information, otherwise
     * the size of the already downloaded content will be used.
     */
    public void setUseHeaderLength(boolean useHeaderLength) {
        kp.put("useHeaderLength",useHeaderLength);
    }
    
    {
        setContentLengthThreshold(-1L);
    }
    public long getContentLengthThreshold() {
        return (Long) kp.get("contentLengthThreshold");
    }
    /**
     * Max content-length this filter will allow to pass through. If -1,
     * then no limit.
     */
    public void setContentLengthThreshold(long threshold) {
        kp.put("contentLengthThreshold",threshold);
    }

    // Header predictor state constants
    public static final int HEADER_PREDICTS_MISSING = -1;
	
    public ResourceNoLongerThanDecideRule() {
    }
    
    protected boolean evaluate(CrawlURI curi) {<FILL_FUNCTION_BODY>}
    
    
    protected boolean test(int contentlength) {
        return contentlength < getContentLengthThreshold();        
    }
}

        int contentlength = HEADER_PREDICTS_MISSING;

        // filter used as midfetch filter
        if (getUseHeaderLength()) {

            // get content-length
            String newContentlength = null;
            if (curi.getHttpResponseHeader("content-length") != null) {
                newContentlength = curi.getHttpResponseHeader("content-length");
            }

            if (newContentlength != null && newContentlength.length() > 0) {
                try {
                    contentlength = Integer.parseInt(newContentlength);
                } catch (NumberFormatException nfe) {
                    // Ignore.
                }
            }

            // If no document length was reported or format was wrong,
            // let pass
            if (contentlength == HEADER_PREDICTS_MISSING) {
                return false;
            }
        } else {
            contentlength = (int) curi.getContentSize();
        }
        
        return test(contentlength);
    
<methods>public void <init>() ,public org.archive.modules.deciderules.DecideResult getDecision() ,public org.archive.modules.deciderules.DecideResult onlyDecision(org.archive.modules.CrawlURI) ,public void setDecision(org.archive.modules.deciderules.DecideResult) <variables>private static final long serialVersionUID