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.
|
javax.ws.rs.core.MediaType |
getMediaType()
Gets the media type.
|
static javax.ws.rs.core.MediaType |
getMediaTypeFromFile(File file)
A utility method for predicting media type from a file name.
|
static javax.ws.rs.core.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 javax.ws.rs.core.MediaType getMediaType()
public static javax.ws.rs.core.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 javax.ws.rs.core.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
.fileName
- the file name from which to predict the MediaType
MediaType
for the give file; null
- if file
is null; "application/octet-stream" if extension not recognized.Copyright © 2007-2021, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.