Package org.web3d.parser.x3d
Class X3DBinaryParser
java.lang.Object
org.web3d.parser.x3d.X3DBinaryParser
- All Implemented Interfaces:
X3DRelaxedParserConstants
A binary parser using FastInfoset to decode files.
- Version:
- $Id: $
- Author:
- Alan Hudson
-
Field Summary
Fields inherited from interface org.web3d.parser.x3d.X3DRelaxedParserConstants
AS, COMPONENT, DEF, DEFAULT, DOT, EOF, EXPORT, EXTERNPROTO, FALSE, ID, ID_FIRST, ID_REST, IMPORT, IN_MULTI_LINE_COMMENT, INITIALIZE_ONLY, INPUT_ONLY, INPUT_OUTPUT, IS, LBRACE, LBRACKET, META, MULTI_LINE_COMMENT, NULL, NUMBER_LITERAL, OUTPUT_ONLY, PROFILE, PROTO, RBRACE, RBRACKET, ROUTE, SCRIPT, SINGLE_LINE_COMMENT, STRING_LITERAL, TO, tokenImage, TRUE, USE
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a new parser instance that has all of the handlers set to the given references.X3DBinaryParser
(InputStream is, ContentHandler ch, RouteHandler rh, ScriptHandler sh, ProtoHandler ph, ErrorHandler eh) Create a new parser instance that has all of the handlers set to the given references.X3DBinaryParser
(Reader rdr) Create a new parser instance that has all of the handlers set to the given references.X3DBinaryParser
(Reader rdr, ContentHandler ch, RouteHandler rh, ScriptHandler sh, ProtoHandler ph, ErrorHandler eh) Create a new parser instance that has all of the handlers set to the given references. -
Method Summary
Modifier and TypeMethodDescriptionFetch the locator used by this parser.void
Initialise the internals of the parser at start up.final void
ReInit
(InputStream is) final void
void
Scene()
Parse the scene nowvoid
Set the content handler instance.void
setDocumentUrl
(String url, String worldURL) Set the base URL of the document that is about to be parsed.void
Set the error handler instance.void
setErrorReporter
(org.j3d.util.ErrorReporter eh) Set the error reporter instance.void
Set the proto handler instance.void
Set the route handler instance.void
Set the script handler instance.
-
Constructor Details
-
X3DBinaryParser
public X3DBinaryParser(InputStream is, ContentHandler ch, RouteHandler rh, ScriptHandler sh, ProtoHandler ph, ErrorHandler eh) Create a new parser instance that has all of the handlers set to the given references. These can be overridden with the set methods below. It is safe to pass in null references here.- Parameters:
is
- The stream to read characters fromch
- The content handler instance to userh
- The route handler instance to usesh
- The script handler instance to useph
- The proto handler instance to useeh
- The error handler instance to use
-
X3DBinaryParser
public X3DBinaryParser(Reader rdr, ContentHandler ch, RouteHandler rh, ScriptHandler sh, ProtoHandler ph, ErrorHandler eh) Create a new parser instance that has all of the handlers set to the given references. These can be overridden with the set methods below. It is safe to pass in null references here.- Parameters:
rdr
- The reader to source characters fromch
- The content handler instance to userh
- The route handler instance to usesh
- The script handler instance to useph
- The proto handler instance to useeh
- The error handler instance to use
-
X3DBinaryParser
Create a new parser instance that has all of the handlers set to the given references. These can be overridden with the set methods below. It is safe to pass in null references here.- Parameters:
is
- The stream to read characters from
-
X3DBinaryParser
Create a new parser instance that has all of the handlers set to the given references. These can be overridden with the set methods below. It is safe to pass in null references here.- Parameters:
rdr
- The reader to source characters from
-
-
Method Details
-
ReInit
-
ReInit
-
initialize
public void initialize()Initialise the internals of the parser at start up. If you are not using the detailed constructors, this needs to be called to ensure that all internal state is correctly set up. -
setDocumentUrl
Set the base URL of the document that is about to be parsed. Users should always call this to make sure we have correct behaviour for the ContentHandler'sstartDocument()
call.The URL is cleared at the end of each document run. Therefore it is imperative that it get's called each time you use the parser.
- Parameters:
url
- The document url to setworldURL
- The worldURL
-
getDocumentLocator
Fetch the locator used by this parser. This is here so that the user of this parser can ask for it and set it before calling startDocument(). Once the scene has started parsing in this class it is too late for the locator to be set. This parser does set it internally when asked for aScene()
but there may be other times when it is not set.- Returns:
- The locator used for syntax errors
-
setContentHandler
Set the content handler instance.- Parameters:
ch
- The content handler instance to use
-
setRouteHandler
Set the route handler instance.- Parameters:
rh
- The route handler instance to use
-
setScriptHandler
Set the script handler instance.- Parameters:
sh
- The script handler instance to use
-
setProtoHandler
Set the proto handler instance.- Parameters:
ph
- The proto handler instance to use
-
setErrorHandler
Set the error handler instance.- Parameters:
eh
- The error handler instance to use
-
setErrorReporter
public void setErrorReporter(org.j3d.util.ErrorReporter eh) Set the error reporter instance. If this is also an ErrorHandler instance, the document locator will also be set.- Parameters:
eh
- The error handler instance to use
-
Scene
-