Package xj3d.filter.importer
Class STLFileParser
java.lang.Object
xj3d.filter.importer.STLFileParser
- All Implemented Interfaces:
NonWeb3DFileParser
File parser implementation that reads STL files and generates an X3D stream
of events.
- Version:
- Grammar $Revision: 1.12 $
- Author:
- Justin Couch
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionFetch the locator used by this parser.void
Initialise the internals of the parser at start up.parse
(InputSource input, String[] style) Parse the input now.void
Set the content handler instance.void
setDocumentUrl
(String url) 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
-
STLFileParser
public STLFileParser()Create a new instance of this parser
-
-
Method Details
-
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.- Specified by:
initialize
in interfaceNonWeb3DFileParser
-
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.
- Specified by:
setDocumentUrl
in interfaceNonWeb3DFileParser
- Parameters:
url
- The document url to set
-
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 a scene but there may be other times when it is not set.- Specified by:
getDocumentLocator
in interfaceNonWeb3DFileParser
- Returns:
- The locator used for syntax errors
-
setContentHandler
Set the content handler instance.- Specified by:
setContentHandler
in interfaceNonWeb3DFileParser
- Parameters:
ch
- The content handler instance to use
-
setRouteHandler
Set the route handler instance.- Specified by:
setRouteHandler
in interfaceNonWeb3DFileParser
- Parameters:
rh
- The route handler instance to use
-
setScriptHandler
Set the script handler instance.- Specified by:
setScriptHandler
in interfaceNonWeb3DFileParser
- Parameters:
sh
- The script handler instance to use
-
setProtoHandler
Set the proto handler instance.- Specified by:
setProtoHandler
in interfaceNonWeb3DFileParser
- Parameters:
ph
- The proto handler instance to use
-
setErrorHandler
Set the error handler instance.- Specified by:
setErrorHandler
in interfaceNonWeb3DFileParser
- 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.- Specified by:
setErrorReporter
in interfaceNonWeb3DFileParser
- Parameters:
eh
- The error handler instance to use
-
parse
Parse the input now.- Specified by:
parse
in interfaceNonWeb3DFileParser
- Parameters:
input
- The stream to read fromstyle
- The style or null or no styling- Returns:
- Null if no parsing issues or a message detailing the issues
- Throws:
IOException
- An I/O error while reading the streamVRMLParseException
- A parsing error occurred in the fileVRMLException
-