Package xj3d.filter.filters
Class LocalURLFilter
java.lang.Object
xj3d.filter.AbstractFilter
xj3d.filter.BaseFilter
xj3d.filter.filters.LocalURLFilter
- All Implemented Interfaces:
BinaryContentHandler
,ContentHandler
,ProtoHandler
,RouteHandler
,ScriptHandler
,StringContentHandler
Strips out all URL fields that are not local.
The following behaviour is implemented:
- remove all fully qualified URL references
- Change all relative URL references to remove any relative directory paths.
- /foo/texture.png becomes texture.png
- foo/texture.png becomes texture.png
- Any URLs that contain query or reference paths shall be removed
None.
- Version:
- $Revision: 1.1 $
- Author:
- Justin Couch
-
Field Summary
Fields inherited from class xj3d.filter.BaseFilter
insideInvalidField, sceneMarker, suppressCalls
Fields inherited from class xj3d.filter.AbstractFilter
contentHandler, documentLocator, errorHandler, fieldHandler, fieldReader, fieldStack, lastErrorCode, majorVersion, minorVersion, nodeStack, parsingType, protoHandler, routeHandler, scriptHandler
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
fieldValue
(String value) The value of a normal field.void
fieldValue
(String[] values) The value of a field given as an array of strings.void
fieldValue
(String[] value, int len) Set the value of the field at the given index as an array of strings.void
Declaration of the start of the document.void
startField
(String name) Notification of a field declaration.Methods inherited from class xj3d.filter.BaseFilter
componentDecl, endDocument, endExternProtoDecl, endField, endNode, endProtoBody, endProtoDecl, endScriptDecl, exportDecl, externProtoURI, fieldValue, fieldValue, fieldValue, fieldValue, fieldValue, fieldValue, fieldValue, fieldValue, fieldValue, fieldValue, getContentHandler, getErrorReporter, getLastErrorCode, getProtoHandler, getRouteHandler, getScriptHandler, importDecl, metaDecl, profileDecl, protoFieldDecl, protoIsDecl, routeDecl, scriptFieldDecl, setArguments, setContentHandler, setDebug, setDocumentLocator, setErrorReporter, setProtoHandler, setRouteHandler, setScriptHandler, startExternProtoDecl, startNode, startProtoBody, startProtoDecl, startScriptDecl, suppressCalls, useDecl
Methods inherited from class xj3d.filter.AbstractFilter
setParsingType
-
Constructor Details
-
LocalURLFilter
public LocalURLFilter()Default constructor
-
-
Method Details
-
startDocument
public void startDocument(String uri, String url, String encoding, String type, String version, String comment) throws SAVException, VRMLException Declaration of the start of the document. The parameters are all of the values that are declared on the header line of the file after the#
start. The type string contains the representation of the first few characters of the file after the #. This allows us to work out if it is VRML97 or the later X3D spec.Version numbers change from VRML97 to X3D and aren't logical. In the first, it is
#VRML V2.0
and the second is#X3D V1.0
even though this second header represents a later spec.- Specified by:
startDocument
in interfaceContentHandler
- Overrides:
startDocument
in classBaseFilter
- Parameters:
uri
- The URI of the file.url
- The base URL of the file for resolving relative URIs contained in the fileencoding
- The encoding of this document - utf8 or binarytype
- The bytes of the first part of the file headerversion
- The full VRML version string of this documentcomment
- Any trailing text on this line. If there is none, this is null.- Throws:
SAVException
- This call is taken at the wrong time in the structure of the document.VRMLException
- This call is taken at the wrong time in the structure of the document.
-
startField
Notification of a field declaration. This notification is only called if it is a standard node. If the node is a script or PROTO declaration then the ScriptHandler or ProtoHandler methods are used.- Specified by:
startField
in interfaceContentHandler
- Overrides:
startField
in classBaseFilter
- Parameters:
name
- The name of the field declared- Throws:
SAVException
- This call is taken at the wrong time in the structure of the documentVRMLException
- The content provided is invalid for this part of the document or can't be parsed
-
fieldValue
The value of a normal field. This is a string that represents the entire value of the field. MFStrings will have to be parsed. This is a terminating call for startField as well. The next call will either be anotherstartField()
orendNode()
.If this field is an SFNode with a USE declaration you will have the
BaseFilter.useDecl(String)
method called rather than this method. If the SFNode is empty the value returned here will be "NULL".There are times where we have an MFField that is declared in the file to be empty. To signify this case, this method will be called with a parameter value of null. A lot of the time this is because we can't really determine if the incoming node is an MFNode or not.
- Specified by:
fieldValue
in interfaceBinaryContentHandler
- Specified by:
fieldValue
in interfaceStringContentHandler
- Overrides:
fieldValue
in classBaseFilter
- Parameters:
value
- The value of this field- Throws:
SAVException
- This call is taken at the wrong time in the structure of the document.VRMLException
- This call is taken at the wrong time in the structure of the document.
-
fieldValue
The value of a field given as an array of strings.- Specified by:
fieldValue
in interfaceStringContentHandler
- Overrides:
fieldValue
in classBaseFilter
- Parameters:
values
- The new value to use for the node- Throws:
SAVException
- This call is taken at the wrong time in the structure of the document.VRMLException
- This call is taken at the wrong time in the structure of the document.
-
fieldValue
Set the value of the field at the given index as an array of strings. This would be used to set MFString field types.- Specified by:
fieldValue
in interfaceBinaryContentHandler
- Overrides:
fieldValue
in classBaseFilter
- Parameters:
value
- The new value to use for the nodelen
- The number of valid entries in the value array- Throws:
SAVException
- This call is taken at the wrong time in the structure of the document.VRMLException
- This call is taken at the wrong time in the structure of the document.
-