Xj3D VRML/X3D Code API

org.web3d.vrml.parser
Class BaseReader

java.lang.Object
  extended byorg.web3d.vrml.parser.BaseReader
All Implemented Interfaces:
VRMLReader

public abstract class BaseReader
extends java.lang.Object
implements VRMLReader

Common reader implementation that can be either strict or lenient in the parsing.

This parser supports the following properties:

Version:
$Revision: 1.5 $
Author:
Justin Couch

Field Summary
protected static java.lang.String CONFORMANCE_PROP
          Name of the property specifying the conformance level
protected  ContentHandler contentHandler
          Reference to the registered content handler if we have one
protected  ErrorHandler errorHandler
          Reference to the registered error handler if we have one
protected  ErrorReporter errorReporter
          Reference to the registered error handler if we have one
protected  boolean ignoreHeader
          Flag to ignore the header
protected  java.util.HashMap properties
          Map of properties held by this reader
protected  ProtoHandler protoHandler
          Reference to the registered proto handler if we have one
protected  RouteHandler routeHandler
          Reference to the registered route handler if we have one
protected  ScriptHandler scriptHandler
          Reference to the registered script handler if we have one
protected static java.lang.String STRICT_CONFORMANCE
          Name of the property value specifying strict conformance
protected static java.lang.String WEAK_CONFORMANCE
          Name of the property value specifying weak conformance
 
Constructor Summary
protected BaseReader()
          Create a new instance of the reader.
 
Method Summary
 ContentHandler getContentHandler()
          Get the currently set ContentHandler instance.
 ErrorReporter getErrorHandler()
          Get the currently set ErrorHandler instance.
 java.lang.Object getProperty(java.lang.String prop)
          Get the value of the named property.
 ProtoHandler getProtoHandler()
          Get the currently set ProtoHandler instance.
 RouteHandler getRouteHandler()
          Get the currently set RouteHandler instance.
 ScriptHandler getScriptHandler()
          Get the currently set ScriptHandler instance.
 void setContentHandler(ContentHandler ch)
          Set the node handler to the given instance.
 void setErrorHandler(ErrorHandler eh)
          Set the error handler to the given instance.
 void setErrorReporter(ErrorReporter ep)
          Set the error reporter instance.
 void setHeaderIgnore(boolean enable)
          Tell the reader that it should not look for the header.
 void setProperty(java.lang.String name, java.lang.Object value)
          Set the value of the named property to the given value.
 void setProtoHandler(ProtoHandler ph)
          Set the proto handler to the given instance.
 void setRouteHandler(RouteHandler rh)
          Set the route handler to the given instance.
 void setScriptHandler(ScriptHandler sh)
          Set the script handler to the given instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.web3d.vrml.sav.VRMLReader
parse
 

Field Detail

CONFORMANCE_PROP

protected static final java.lang.String CONFORMANCE_PROP
Name of the property specifying the conformance level

See Also:
Constant Field Values

WEAK_CONFORMANCE

protected static final java.lang.String WEAK_CONFORMANCE
Name of the property value specifying weak conformance

See Also:
Constant Field Values

STRICT_CONFORMANCE

protected static final java.lang.String STRICT_CONFORMANCE
Name of the property value specifying strict conformance

See Also:
Constant Field Values

properties

protected java.util.HashMap properties
Map of properties held by this reader


contentHandler

protected ContentHandler contentHandler
Reference to the registered content handler if we have one


routeHandler

protected RouteHandler routeHandler
Reference to the registered route handler if we have one


scriptHandler

protected ScriptHandler scriptHandler
Reference to the registered script handler if we have one


protoHandler

protected ProtoHandler protoHandler
Reference to the registered proto handler if we have one


errorReporter

protected ErrorReporter errorReporter
Reference to the registered error handler if we have one


errorHandler

protected ErrorHandler errorHandler
Reference to the registered error handler if we have one


ignoreHeader

protected boolean ignoreHeader
Flag to ignore the header

Constructor Detail

BaseReader

protected BaseReader()
Create a new instance of the reader. Does not initialise anything until we know what sort of input file we have.

Method Detail

getProperty

public java.lang.Object getProperty(java.lang.String prop)
                             throws SAVNotSupportedException
Get the value of the named property. VRMLReaders are not required to support any specific property names.

Specified by:
getProperty in interface VRMLReader
Parameters:
prop - The name of the property to get the value of
Returns:
The value of the set property or null if not set
Throws:
SAVNotSupportedException - The VRMLReader does not recognize or does not support this property name.

setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object value)
                 throws SAVNotSupportedException
Set the value of the named property to the given value. VRMLReaders are not required to support any specific property names. Using a value of null will clear the currently set property value.

Specified by:
setProperty in interface VRMLReader
Parameters:
name - The name of the property to set
value - The value of this property
Throws:
SAVNotSupportedException - The VRMLReader does not recognize or does not support this property name.

setHeaderIgnore

public void setHeaderIgnore(boolean enable)
Tell the reader that it should not look for the header. This is needed to deal with createVrmlFromString() calls that do not include the header as part of the stream and would otherwise cause an error.

Specified by:
setHeaderIgnore in interface VRMLReader
Parameters:
enable - true to stop looking for a header

getErrorHandler

public ErrorReporter getErrorHandler()
Get the currently set ErrorHandler instance. If nothing is set it will return null.

Specified by:
getErrorHandler in interface VRMLReader
Returns:
The currently set error handler.

setErrorHandler

public void setErrorHandler(ErrorHandler eh)
Set the error handler to the given instance. If the value is null it will clear the currently set instance.

Specified by:
setErrorHandler in interface VRMLReader
Parameters:
eh - The error handler instance to use

setErrorReporter

public void setErrorReporter(ErrorReporter ep)
Set the error reporter instance. If this is also an ErrorHandler instance, the document locator will also be set.

Specified by:
setErrorReporter in interface VRMLReader
Parameters:
ep - The error reporter instance to use

getContentHandler

public ContentHandler getContentHandler()
Get the currently set ContentHandler instance. If nothing is set it will return null.

Specified by:
getContentHandler in interface VRMLReader
Returns:
The currently set node handler.

setContentHandler

public void setContentHandler(ContentHandler ch)
Set the node handler to the given instance. If the value is null it will clear the currently set instance.

Specified by:
setContentHandler in interface VRMLReader
Parameters:
ch - The content handler instance to use

getScriptHandler

public ScriptHandler getScriptHandler()
Get the currently set ScriptHandler instance. If nothing is set it will return null.

Specified by:
getScriptHandler in interface VRMLReader
Returns:
The currently set script handler.

setScriptHandler

public void setScriptHandler(ScriptHandler sh)
Set the script handler to the given instance. If the value is null it will clear the currently set instance.

Specified by:
setScriptHandler in interface VRMLReader
Parameters:
sh - The script handler instance to use

getProtoHandler

public ProtoHandler getProtoHandler()
Get the currently set ProtoHandler instance. If nothing is set it will return null.

Specified by:
getProtoHandler in interface VRMLReader
Returns:
The currently set proto handler.

setProtoHandler

public void setProtoHandler(ProtoHandler ph)
Set the proto handler to the given instance. If the value is null it will clear the currently set instance.

Specified by:
setProtoHandler in interface VRMLReader
Parameters:
ph - The proto handler instance to use

getRouteHandler

public RouteHandler getRouteHandler()
Get the currently set RouteHandler instance. If nothing is set it will return null.

Specified by:
getRouteHandler in interface VRMLReader
Returns:
The currently set route handler.

setRouteHandler

public void setRouteHandler(RouteHandler rh)
Set the route handler to the given instance. If the value is null it will clear the currently set instance.

Specified by:
setRouteHandler in interface VRMLReader
Parameters:
rh - The route handler instance to use

Xj3D VRML/X3D Code API

Copyright © 2001 - 2005 Web3D Consortium