001 package org.relaxng.datatype; 002 003 /** 004 * Datatype streaming validator. 005 * 006 * <p> 007 * The streaming validator is an optional feature that is useful for 008 * certain Datatypes. It allows the caller to incrementally provide 009 * the literal. 010 * 011 * @author <a href="mailto:jjc@jclark.com">James Clark</a> 012 * @author <a href="mailto:kohsuke.kawaguchi@sun.com">Kohsuke KAWAGUCHI</a> 013 */ 014 public interface DatatypeStreamingValidator { 015 016 /** 017 * Passes an additional fragment of the literal. 018 * 019 * <p> 020 * The application can call this method several times, then call 021 * the isValid method (or the checkValid method) to check the validity 022 * of the accumulated characters. 023 */ 024 void addCharacters( char[] buf, int start, int len ); 025 026 /** 027 * Tells if the accumulated literal is valid with respect to 028 * the underlying Datatype. 029 * 030 * @return 031 * True if it is valid. False if otherwise. 032 */ 033 boolean isValid(); 034 035 /** 036 * Similar to the isValid method, but this method throws 037 * Exception (with possibly diagnostic information), instead of 038 * returning false. 039 * 040 * @exception DatatypeException 041 * If the callee supports the diagnosis and the accumulated 042 * literal is invalid, then this exception that possibly 043 * contains diagnosis information is thrown. 044 */ 045 void checkValid() throws DatatypeException; 046 }