com.sun.jersey.multipart.file
Enum DefaultMediaTypePredictor.CommonMediaTypes

java.lang.Object
  extended by java.lang.Enum<DefaultMediaTypePredictor.CommonMediaTypes>
      extended by com.sun.jersey.multipart.file.DefaultMediaTypePredictor.CommonMediaTypes
All Implemented Interfaces:
Serializable, Comparable<DefaultMediaTypePredictor.CommonMediaTypes>
Enclosing class:
DefaultMediaTypePredictor

public static enum DefaultMediaTypePredictor.CommonMediaTypes
extends Enum<DefaultMediaTypePredictor.CommonMediaTypes>

This enum represents file extension and MIME types of commonly used file. It is to be noted that all file extension and MIME types are specified in lower case, when checking the extension this should be kept in mind. Curently supported file extension and MIME Types are -


Enum Constant Summary
AVI
           
BMP
           
GIF
           
GZ
           
HTM
           
HTML
           
JPG
           
MP3
           
MPEG
           
PDF
           
PNG
           
RAR
           
TAR
           
TXT
           
WAV
           
XML
           
ZIP
           
 
Method Summary
 String getExtension()
          Get the file extension.
 MediaType getMediaType()
          Get the media type.
static MediaType getMediaTypeFromFile(File file)
          A utility method for predicting media type from a file name.
static MediaType getMediaTypeFromFileName(String fileName)
          A utility method for predicting media type from a file name.
static DefaultMediaTypePredictor.CommonMediaTypes valueOf(String name)
          Returns the enum constant of this type with the specified name.
static DefaultMediaTypePredictor.CommonMediaTypes[] 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

XML

public static final DefaultMediaTypePredictor.CommonMediaTypes XML

TXT

public static final DefaultMediaTypePredictor.CommonMediaTypes TXT

HTM

public static final DefaultMediaTypePredictor.CommonMediaTypes HTM

HTML

public static final DefaultMediaTypePredictor.CommonMediaTypes HTML

PDF

public static final DefaultMediaTypePredictor.CommonMediaTypes PDF

JPG

public static final DefaultMediaTypePredictor.CommonMediaTypes JPG

PNG

public static final DefaultMediaTypePredictor.CommonMediaTypes PNG

GIF

public static final DefaultMediaTypePredictor.CommonMediaTypes GIF

BMP

public static final DefaultMediaTypePredictor.CommonMediaTypes BMP

TAR

public static final DefaultMediaTypePredictor.CommonMediaTypes TAR

ZIP

public static final DefaultMediaTypePredictor.CommonMediaTypes ZIP

GZ

public static final DefaultMediaTypePredictor.CommonMediaTypes GZ

RAR

public static final DefaultMediaTypePredictor.CommonMediaTypes RAR

MP3

public static final DefaultMediaTypePredictor.CommonMediaTypes MP3

WAV

public static final DefaultMediaTypePredictor.CommonMediaTypes WAV

AVI

public static final DefaultMediaTypePredictor.CommonMediaTypes AVI

MPEG

public static final DefaultMediaTypePredictor.CommonMediaTypes MPEG
Method Detail

values

public static DefaultMediaTypePredictor.CommonMediaTypes[] 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 (DefaultMediaTypePredictor.CommonMediaTypes c : DefaultMediaTypePredictor.CommonMediaTypes.values())
    System.out.println(c);

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

valueOf

public static DefaultMediaTypePredictor.CommonMediaTypes 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

getExtension

public String getExtension()
Get the file extension.

Returns:
the file extension.

getMediaType

public MediaType getMediaType()
Get the media type.

Returns:
the media type.

getMediaTypeFromFile

public static MediaType getMediaTypeFromFile(File file)
A utility method for predicting media type from a file name.

Parameters:
file - The file from which to predict the MediaType
Returns:
The MediaType for the give file; null - if file is null; "application/octet-stream" if extension not recognized.
See Also:
getMediaTypeFromFileName(java.lang.String)

getMediaTypeFromFileName

public static MediaType getMediaTypeFromFileName(String fileName)
A utility method for predicting media type from a file name. If the file name extension is not recognised it will return MediaType for "*\/*", it will also return the same if the file is null. Currently supported file extensions can be found at DefaultMediaTypePredictor.CommonMediaTypes.

Parameters:
fileName - The file name from which to predict the MediaType
Returns:
The MediaType for the give file; null - if file is null; "application/octet-stream" if extension not recognized.


Copyright © 2013 Oracle Corporation. All Rights Reserved.