DLESE Tools
v1.6.0

org.dlese.dpc.ndr.toolkit
Class MimeTypes

java.lang.Object
  extended by org.dlese.dpc.ndr.toolkit.MimeTypes

public class MimeTypes
extends Object

Singleton utility class to determine the mime-type of a file based on its extension.

Usage:

Author:
Jonathan Ostwald

Method Summary
static MimeTypes getInstance()
          Gets the instance attribute of the MimeTypes class
 String getMimeType(File file)
          Gets the mimeType associated with the provided file (based on the file's name).
 String getMimeType(String filename)
          Gets the mimeType for the provided filename.
static void main(String[] args)
          The main program for the MimeTypes class
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static MimeTypes getInstance()
Gets the instance attribute of the MimeTypes class

Returns:
The instance value

getMimeType

public String getMimeType(String filename)
Gets the mimeType for the provided filename.

Parameters:
filename - a string having an extention ("name.ext").
Returns:
The mimeType value or null if either one is not found or if the provided filename does not contain a dot (".").

getMimeType

public String getMimeType(File file)
Gets the mimeType associated with the provided file (based on the file's name).

Parameters:
file - file named with a dot extension.
Returns:
The mimeType value (e.g., "image/gif");

main

public static void main(String[] args)
                 throws Exception
The main program for the MimeTypes class

Parameters:
args - The command line arguments
Throws:
Exception - NOT YET DOCUMENTED

DLESE Tools
v1.6.0