public static enum DefaultMediaTypePredictor.CommonMediaTypes extends Enum<DefaultMediaTypePredictor.CommonMediaTypes>
Enum Constant and Description |
---|
AVI |
BMP |
GIF |
GZ |
HTM |
HTML |
JPG |
MP3 |
MPEG |
PDF |
PNG |
RAR |
TAR |
TXT |
WAV |
XML |
ZIP |
Modifier and Type | Method and Description |
---|---|
String |
getExtension()
Gets the file extension.
|
MediaType |
getMediaType()
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.
|
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.
|
public static final DefaultMediaTypePredictor.CommonMediaTypes XML
public static final DefaultMediaTypePredictor.CommonMediaTypes TXT
public static final DefaultMediaTypePredictor.CommonMediaTypes HTM
public static final DefaultMediaTypePredictor.CommonMediaTypes HTML
public static final DefaultMediaTypePredictor.CommonMediaTypes PDF
public static final DefaultMediaTypePredictor.CommonMediaTypes JPG
public static final DefaultMediaTypePredictor.CommonMediaTypes PNG
public static final DefaultMediaTypePredictor.CommonMediaTypes GIF
public static final DefaultMediaTypePredictor.CommonMediaTypes BMP
public static final DefaultMediaTypePredictor.CommonMediaTypes TAR
public static final DefaultMediaTypePredictor.CommonMediaTypes ZIP
public static final DefaultMediaTypePredictor.CommonMediaTypes GZ
public static final DefaultMediaTypePredictor.CommonMediaTypes RAR
public static final DefaultMediaTypePredictor.CommonMediaTypes MP3
public static final DefaultMediaTypePredictor.CommonMediaTypes WAV
public static final DefaultMediaTypePredictor.CommonMediaTypes AVI
public static final DefaultMediaTypePredictor.CommonMediaTypes MPEG
public static DefaultMediaTypePredictor.CommonMediaTypes[] values()
for (DefaultMediaTypePredictor.CommonMediaTypes c : DefaultMediaTypePredictor.CommonMediaTypes.values()) System.out.println(c);
public static DefaultMediaTypePredictor.CommonMediaTypes valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic String getExtension()
public MediaType getMediaType()
public static MediaType getMediaTypeFromFile(File file)
file
- the file from which to predict the MediaType
MediaType
for the give file; null
- if file
is null; "application/octet-stream" if extension not recognized.getMediaTypeFromFileName(java.lang.String)
public static MediaType getMediaTypeFromFileName(String fileName)
MediaType
for
"*\/*", it will also return the same if the file is null
.
Currently supported file extensions can be found at DefaultMediaTypePredictor.CommonMediaTypes
.Copyright © 2007-2017, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.