Enum Class DefaultMediaTypePredictor.CommonMediaTypes
java.lang.Object
java.lang.Enum<DefaultMediaTypePredictor.CommonMediaTypes>
org.glassfish.jersey.media.multipart.file.DefaultMediaTypePredictor.CommonMediaTypes
- All Implemented Interfaces:
Serializable
,Comparable<DefaultMediaTypePredictor.CommonMediaTypes>
,java.lang.constant.Constable
- 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.
Currently supported file extension and MIME Types are -
- ".xml" - application/xml
- ".json - application/json
- ".txt" - text/plain
- ".pdf" - application/pdf
- ".htm" - text/html
- ".html" - text/html
- ".jpg" - image/jpeg
- ".png" - image/png
- ".gif" - image/gif
- ".bmp" - image/bmp
- ".tar" - application/x-tar
- ".zip" - application/zip
- ".gz" - application/x-gzip
- ".rar" - application/x-rar
- ".mp3" - audio/mpeg
- ".wav" - audio/x-wave
- ".avi" - video/x-msvideo
- ".mpeg" - video/mpeg
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
-
Method Summary
Modifier and TypeMethodDescriptionGets the file extension.Gets 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.Returns the enum constant of this class with the specified name.values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
XML
-
JSON
-
TXT
-
HTM
-
HTML
-
PDF
-
JPG
-
PNG
-
GIF
-
BMP
-
TAR
-
ZIP
-
GZ
-
RAR
-
MP3
-
WAV
-
AVI
-
MPEG
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified nameNullPointerException
- if the argument is null
-
getExtension
Gets the file extension.- Returns:
- the file extension.
-
getMediaType
Gets the media type.- Returns:
- the media type.
-
getMediaTypeFromFile
A utility method for predicting media type from a file name. -
getMediaTypeFromFileName
A utility method for predicting media type from a file name. If the file name extension is not recognised it will returnMediaType
for "*\/*", it will also return the same if the file isnull
. Currently supported file extensions can be found atDefaultMediaTypePredictor.CommonMediaTypes
.
-