Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

java.net
Class MimeTypeMapper  view MimeTypeMapper download MimeTypeMapper.java

java.lang.Object
  extended byjava.net.MimeTypeMapper
All Implemented Interfaces:
FileNameMap

class MimeTypeMapper
extends java.lang.Object
implements FileNameMap

This non-public class is used to implement the FileNameMap interface which defines a mechanism for mapping filenames to MIME types.

Version:
0.5

Field Summary
protected static java.lang.String[][] mime_strings
          This array of strings is used to identify a MIME type based on a file extension.
private static java.util.Hashtable mime_types
          The MIME types above are put into this Hashtable for faster lookup.
 
Constructor Summary
MimeTypeMapper()
          Create a new MimeTypeMapper object.
 
Method Summary
 java.lang.String getContentTypeFor(java.lang.String filename)
          The method returns the MIME type of the filename passed as an argument.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mime_strings

protected static final java.lang.String[][] mime_strings
This array of strings is used to identify a MIME type based on a file extension. This is list is based on the Apache mime.types file.


mime_types

private static java.util.Hashtable mime_types
The MIME types above are put into this Hashtable for faster lookup.

Constructor Detail

MimeTypeMapper

public MimeTypeMapper()
Create a new MimeTypeMapper object.

Method Detail

getContentTypeFor

public java.lang.String getContentTypeFor(java.lang.String filename)
The method returns the MIME type of the filename passed as an argument. The value returned is based on the extension of the filename. The default content type returned if this method cannot determine the actual content type is "application/octet-stream"

Specified by:
getContentTypeFor in interface FileNameMap