Xj3D VRML/X3D Code API

org.web3d.net.content
Class VRMLFileNameMap

java.lang.Object
  extended byorg.web3d.net.content.VRMLFileNameMap
All Implemented Interfaces:
java.net.FileNameMap, org.ietf.uri.FileNameMap

public class VRMLFileNameMap
extends java.lang.Object
implements 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
VRMLFileNameMap()
          Create 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
 java.lang.String getContentTypeFor(java.lang.String filename)
          Fetch the content type for the given file name.
 java.lang.String getFileExtension(java.lang.String mimetype)
          Get the standardised extension used for the given MIME type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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 Detail

getContentTypeFor

public java.lang.String getContentTypeFor(java.lang.String filename)
Fetch the content type for the given file name. If we don't understand the file name, return null.

Specified by:
getContentTypeFor in interface java.net.FileNameMap
Parameters:
filename - The name of the file to check
Returns:
The content type for that file

getFileExtension

public java.lang.String getFileExtension(java.lang.String mimetype)
Get the standardised extension used for the given MIME type. This provides a reverse mapping feature over the standard FileNameMap that only supplies the opposite method.

Specified by:
getFileExtension in interface org.ietf.uri.FileNameMap
Parameters:
mimetype - The mime type to check for
Returns:
The extension or null if it cannot be resolved

Xj3D VRML/X3D Code API

Copyright © 2001 - 2005 Web3D Consortium