drools-eclipse/org.guvnor.eclipse.webdav/src/kernel/org/eclipse/webdav/internal/kernel/Condition.java
public static Condition create(StreamTokenizer tokenizer) throws WebDAVException {
        Condition condition = new Condition();
        try {
            int token = tokenizer.ttype;
            if (token == '<') {
                token = tokenizer.nextToken();
                if (token == StreamTokenizer.TT_WORD) {
                    condition.setResourceURI(tokenizer.sval);
                } else {
                    throw new WebDAVException(IResponse.SC_BAD_REQUEST, Policy.bind("error.parseMissingResource")); //$NON-NLS-1$
                }
                token = tokenizer.nextToken();
                if (token == '>') {
                    token = tokenizer.nextToken();
                } else {
                    throw new WebDAVException(IResponse.SC_BAD_REQUEST, Policy.bind("error.parseMissing", String.valueOf(token), ">")); //$NON-NLS-1$ //$NON-NLS-2$
                }
            }
            if (token == '(') {
                while (token == '(') {
                    condition.addConditionTerm(ConditionTerm.create(tokenizer));
                    token = tokenizer.ttype;
                }
            } else {
                throw new WebDAVException(IResponse.SC_BAD_REQUEST, Policy.bind("error.parseMissingStart", String.valueOf(token))); //$NON-NLS-1$
            }
        } catch (IOException exc) {
            // ignore or log?
        }
        return condition;
    }
public static Condition create(StreamTokenizer tokenizer) throws WebDAVException {
        Condition condition = new Condition();
        try {
            int token = tokenizer.ttype;
            if (token == '<') {
                token = tokenizer.nextToken();
                if (token == StreamTokenizer.TT_WORD) {
                    condition.setResourceURI(tokenizer.sval);
                } else {
                    throw new WebDAVException(IResponse.SC_BAD_REQUEST, Policy.bind("error.parseMissingResource")); //$NON-NLS-1$
                }
                token = tokenizer.nextToken();
                if (token == '>') {
                    token = tokenizer.nextToken();
                } else {
                    throw new WebDAVException(IResponse.SC_BAD_REQUEST, Policy.bind("error.parseMissing", String.valueOf(token), ">")); //$NON-NLS-1$ //$NON-NLS-2$
                }
            }
            if (token == '(') {
                while (token == '(') {
                    condition.addConditionTerm(ConditionTerm.create(tokenizer));
                    token = tokenizer.ttype;
                }
            } else {
                throw new WebDAVException(IResponse.SC_BAD_REQUEST, Policy.bind("error.parseMissingStart", String.valueOf(token))); //$NON-NLS-1$
            }
        } catch (IOException exc) {
            // ignore or log?
        }
        return condition;
    }
public static Condition create ( StreamTokenizer tokenizer ) throws WebDAVException { Condition condition = new Condition ( ) ; try { int token = tokenizer . ttype ; if ( token == ' ' ) { token = tokenizer . nextToken ( ) ; if ( token == StreamTokenizer . TT_WORD ) { condition . setResourceURI ( tokenizer . sval ) ; } else { throw new WebDAVException ( IResponse . SC_BAD_REQUEST , Policy . bind ( "error.parseMissingResource" ) ) ; //$NON-NLS-1$ } token = tokenizer . nextToken ( ) ; if ( token == ' ' ) { token = tokenizer . nextToken ( ) ; } else { throw new WebDAVException ( IResponse . SC_BAD_REQUEST , Policy . bind ( "error.parseMissing" , String . valueOf ( token ) , ">" ) ) ; //$NON-NLS-1$ //$NON-NLS-2$ } } if ( token == ' ' ) { while ( token == ' ' ) { condition . addConditionTerm ( ConditionTerm . create ( tokenizer ) ) ; token = tokenizer . ttype ; } } else { throw new WebDAVException ( IResponse . SC_BAD_REQUEST , Policy . bind ( "error.parseMissingStart" , String . valueOf ( token ) ) ) ; //$NON-NLS-1$ } } catch ( IOException exc ) { // ignore or log? } return condition ; }
Create a Condition by parsing the given If header as defined by
section 9.4 in the WebDAV spec.

@param tokenizer a StreamTokenizer on the contents of a WebDAV If header
@return the parsed condition
Create a Condition by parsing the given If header as defined by section 9 . 4 in the WebDAV spec .