org.exist.util
Class MimeTable

java.lang.Object
  extended by org.exist.util.MimeTable

public class MimeTable
extends Object

Global table of mime types. This singleton class maintains a list of mime types known to the system. It is used to look up the mime type for a specific file extension and to check if a file is an XML or binary resource. The mime type table is read from a file "mime-types.xml", which should reside in the directory identified in the exist home directory. If no such file is found, the class tries to load the default map from the org.exist.util package via the class loader.

Author:
wolf

Constructor Summary
MimeTable()
           
MimeTable(File f)
           
MimeTable(InputStream stream, String src)
           
 
Method Summary
 Vector getAllExtensions(MimeType mimeType)
           
 Vector getAllExtensions(String mimeType)
           
 MimeType getContentType(String mimeType)
           
 MimeType getContentTypeFor(String fileName)
           
 MimeType getContentTypeFor(XmldbURI fileName)
           
static MimeTable getInstance()
          Returns the singleton.
static MimeTable getInstance(File f)
          Returns the singleton, using a custom mime-types.xml file
static MimeTable getInstance(InputStream stream, String src)
          Returns the singleton, using a custom mime-types.xml stream, like for instance an internal database resource.
 String getPreferredExtension(MimeType mimeType)
           
 String getPreferredExtension(String mimeType)
           
 String getSrc()
          Inform from where a mime-table is loaded
 boolean isXMLContent(String fileName)
           
static void main(String[] args)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MimeTable

public MimeTable()

MimeTable

public MimeTable(File f)

MimeTable

public MimeTable(InputStream stream,
                 String src)
Method Detail

getInstance

public static MimeTable getInstance()
Returns the singleton.


getInstance

public static MimeTable getInstance(File f)
Returns the singleton, using a custom mime-types.xml file


getInstance

public static MimeTable getInstance(InputStream stream,
                                    String src)
Returns the singleton, using a custom mime-types.xml stream, like for instance an internal database resource.


getSrc

public String getSrc()
Inform from where a mime-table is loaded


getContentTypeFor

public MimeType getContentTypeFor(String fileName)

getContentTypeFor

public MimeType getContentTypeFor(XmldbURI fileName)

getContentType

public MimeType getContentType(String mimeType)

getAllExtensions

public Vector getAllExtensions(MimeType mimeType)

getAllExtensions

public Vector getAllExtensions(String mimeType)

getPreferredExtension

public String getPreferredExtension(MimeType mimeType)

getPreferredExtension

public String getPreferredExtension(String mimeType)

isXMLContent

public boolean isXMLContent(String fileName)

main

public static void main(String[] args)


Copyright (C) Wolfgang Meier. All rights reserved.