org.cert.cc.jira.email
Enum MimeTypeMapper

java.lang.Object
  extended by java.lang.Enum<MimeTypeMapper>
      extended by org.cert.cc.jira.email.MimeTypeMapper
All Implemented Interfaces:
Serializable, Comparable<MimeTypeMapper>

public enum MimeTypeMapper
extends Enum<MimeTypeMapper>

MimeTypeMapper returns the correct MIME type based on a filename. If one cannot be determied, application/octet-stream will be returned. The mime.types file is read in from the classpath. JIRA has an extensive mime.types already included in its classpath. If the mime.types is not in the classpath, /etc/mime.types is used. If any errors occur while reading in the mime.types file, a default instance of MimetypesFileTypeMap is used. The /etc/mime.types file is only read in once.

© 2010 Carnegie Mellon University

Author:
Steve Scholnick
See Also:
MimetypesFileTypeMap

Enum Constant Summary
INSTANCE
           
 
Method Summary
static MimeTypeMapper getInstance()
          Single access point
 String getType(String filename)
          Calculates and returns the MIME type.
static MimeTypeMapper valueOf(String name)
          Returns the enum constant of this type with the specified name.
static MimeTypeMapper[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

INSTANCE

public static final MimeTypeMapper INSTANCE
Method Detail

values

public static MimeTypeMapper[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (MimeTypeMapper c : MimeTypeMapper.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static MimeTypeMapper valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

getInstance

public static MimeTypeMapper getInstance()
Single access point


getType

public String getType(String filename)
Calculates and returns the MIME type. application/octet-stream will be returned if a MIME type cannot be determined.

Parameters:
filename - Filename to be checked
Returns:
MIME type


Copyright © 2012 Carnegie Mellon University