org.relaxng.datatype.helpers
Class StreamingValidatorImpl

java.lang.Object
  |
  +--org.relaxng.datatype.helpers.StreamingValidatorImpl
All Implemented Interfaces:
DataTypeStreamingValidator

public final class StreamingValidatorImpl
extends java.lang.Object
implements DataTypeStreamingValidator

Dummy implementation of DataTypeStreamingValidator. This implementation can be used as a quick hack when the performance of streaming validation is not important.

Typical usage would be:


 class MyDataType implements DataType {
     ....
     public DataTypeStreamingValidator createStreamingValidator( ValidationContext context ) {
         return new StreamingValidatorImpl(this,context);
     }
     ....
 }
 

Author:
Kohsuke KAWAGUCHI

Constructor Summary
StreamingValidatorImpl(DataType baseType, ValidationContext context)
           
 
Method Summary
 boolean characters(char[] buf, int start, int len)
          let a streaming validator process additional literal fragment.
 boolean isValid()
          gets if the accumulated literal is valid with respect to the underlying datatype.
 void reset()
          purges the accumulated literal, and start all over again.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StreamingValidatorImpl

public StreamingValidatorImpl(DataType baseType,
                              ValidationContext context)
Method Detail

reset

public void reset()
Description copied from interface: DataTypeStreamingValidator
purges the accumulated literal, and start all over again.

This method can be used to reduce the number of the creation of this datatype.

Specified by:
reset in interface DataTypeStreamingValidator

characters

public boolean characters(char[] buf,
                          int start,
                          int len)
Description copied from interface: DataTypeStreamingValidator
let a streaming validator process additional literal fragment.

The application can call this method several times, then call the isValid method to check the validity.

Specified by:
characters in interface DataTypeStreamingValidator
Following copied from interface: org.relaxng.datatype.DataTypeStreamingValidator
Returns:
the return value of this method is the return value of the isValid method after processing new literal fragment.

isValid

public boolean isValid()
Description copied from interface: DataTypeStreamingValidator
gets if the accumulated literal is valid with respect to the underlying datatype.
Specified by:
isValid in interface DataTypeStreamingValidator
Following copied from interface: org.relaxng.datatype.DataTypeStreamingValidator
Returns:
true if it is valid. False if otherwise.