Package org.web3d.net.content
Class VRMLFileNameMap
java.lang.Object
org.web3d.net.content.VRMLFileNameMap
- All Implemented Interfaces:
FileNameMap
,org.ietf.uri.FileNameMap
An implementation of a file name mapping for handling VRML file types.
When asked for a .wrl file it will return model/vrml
. For the
reverse mapping it will handle both the old and new types
This filename mapping must be registered with the URI class by the user in order to work. You can use the following code to do this:
import org.ietf.uri.URI; import org.ietf.uri.FileNameMap; ... FileNameMap fn_map = URI.getFileNameMap(); if(!(fn_map instanceof VRMLFileNameMap)) { fn_map = new VRMLFileNameMap(fn_map); URI.setFileNameMap(fn_map); }
- Version:
- $Revision: 1.7 $
- Author:
- Justin Couch
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a default filename map that does not delegate to any other map if we can't resolve it.VRMLFileNameMap
(org.ietf.uri.FileNameMap map) Create a filename map that will delegate to the given map if we cannot resolve the name locally. -
Method Summary
Modifier and TypeMethodDescriptiongetContentTypeFor
(String filename) Fetch the content type for the given file name.getFileExtension
(String mimetype) Get the standardised extension used for the given MIME type.
-
Constructor Details
-
VRMLFileNameMap
public VRMLFileNameMap()Create a default filename map that does not delegate to any other map if we can't resolve it. -
VRMLFileNameMap
public VRMLFileNameMap(org.ietf.uri.FileNameMap map) Create a filename map that will delegate to the given map if we cannot resolve the name locally. If the parameter is null, no checking will be done.- Parameters:
map
- The map to delegate to
-
-
Method Details
-
getContentTypeFor
Fetch the content type for the given file name. If we don't understand the file name, return null.- Specified by:
getContentTypeFor
in interfaceFileNameMap
- Parameters:
filename
- The name of the file to check- Returns:
- The content type for that file
-
getFileExtension
Get the standardised extension used for the given MIME type. This provides a reverse mapping feature over the standardFileNameMap
that only supplies the opposite method.- Specified by:
getFileExtension
in interfaceorg.ietf.uri.FileNameMap
- Parameters:
mimetype
- The mime type to check for- Returns:
- The extension or
null
if it cannot be resolved
-