public final class MediaType extends Metadata
Metadata.getName()
method returns a full String representation of the media
type including the parameters.Constructor and Description |
---|
MediaType(java.lang.String name)
Constructor.
|
MediaType(java.lang.String name,
Series<Parameter> parameters)
Constructor.
|
MediaType(java.lang.String name,
Series<Parameter> parameters,
java.lang.String description)
Constructor.
|
MediaType(java.lang.String name,
java.lang.String description)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
boolean |
equals(java.lang.Object obj,
boolean ignoreParameters)
Test the equality of two media types, with the possibility to ignore the
parameters.
|
java.lang.String |
getMainType()
Returns the main type.
|
static MediaType |
getMostSpecific(MediaType... mediaTypes)
Returns the first of the most specific media type of the given array of
MediaType s. |
Series<Parameter> |
getParameters()
Returns the unmodifiable list of parameters corresponding to subtype
modifiers.
|
MediaType |
getParent()
Returns the parent metadata if available or null.
|
java.lang.String |
getSubType()
Returns the sub-type.
|
int |
hashCode() |
boolean |
includes(Metadata included)
Indicates if a given media type is included in the current one @see
includes(Metadata, boolean) . |
boolean |
includes(Metadata included,
boolean ignoreParameters)
Indicates if a given media type is included in the current one @see
includes(Metadata, boolean) . |
boolean |
isConcrete()
Checks if the current media type is concrete.
|
static MediaType |
register(java.lang.String name,
java.lang.String description)
Register a media type as a known type that can later be retrieved using
valueOf(String) . |
static MediaType |
valueOf(java.lang.String name)
Returns the media type associated to a name.
|
getDescription, getName, isCompatible, toString
public static final MediaType ALL
public static final MediaType APPLICATION_ALL
public static final MediaType APPLICATION_ALL_JSON
public static final MediaType APPLICATION_ALL_XML
public static final MediaType APPLICATION_ATOM
public static final MediaType APPLICATION_ATOMPUB_CATEGORY
public static final MediaType APPLICATION_ATOMPUB_SERVICE
public static final MediaType APPLICATION_CAB
public static final MediaType APPLICATION_COMPRESS
public static final MediaType APPLICATION_ECORE
public static final MediaType APPLICATION_EXCEL
public static final MediaType APPLICATION_FLASH
public static final MediaType APPLICATION_GNU_TAR
public static final MediaType APPLICATION_GNU_ZIP
public static final MediaType APPLICATION_HTTP_COOKIES
public static final MediaType APPLICATION_JAVA
public static final MediaType APPLICATION_JAVA_ARCHIVE
public static final MediaType APPLICATION_JAVA_OBJECT
public static final MediaType APPLICATION_JAVA_OBJECT_GWT
public static final MediaType APPLICATION_JAVA_OBJECT_XML
public static final MediaType APPLICATION_JAVASCRIPT
public static final MediaType APPLICATION_JNLP
public static final MediaType APPLICATION_JSON
public static final MediaType APPLICATION_JSON_ACTIVITY
public static final MediaType APPLICATION_JSON_PATCH
public static final MediaType APPLICATION_JSON_SMILE
public static final MediaType APPLICATION_KML
public static final MediaType APPLICATION_KMZ
public static final MediaType APPLICATION_LATEX
public static final MediaType APPLICATION_MAC_BINHEX40
public static final MediaType APPLICATION_MATHML
public static final MediaType APPLICATION_MSML
public static final MediaType APPLICATION_MSOFFICE_DOCM
public static final MediaType APPLICATION_MSOFFICE_DOCX
public static final MediaType APPLICATION_MSOFFICE_DOTM
public static final MediaType APPLICATION_MSOFFICE_DOTX
public static final MediaType APPLICATION_MSOFFICE_ONETOC
public static final MediaType APPLICATION_MSOFFICE_ONETOC2
public static final MediaType APPLICATION_MSOFFICE_POTM
public static final MediaType APPLICATION_MSOFFICE_POTX
public static final MediaType APPLICATION_MSOFFICE_PPAM
public static final MediaType APPLICATION_MSOFFICE_PPSM
public static final MediaType APPLICATION_MSOFFICE_PPSX
public static final MediaType APPLICATION_MSOFFICE_PPTM
public static final MediaType APPLICATION_MSOFFICE_PPTX
public static final MediaType APPLICATION_MSOFFICE_SLDM
public static final MediaType APPLICATION_MSOFFICE_SLDX
public static final MediaType APPLICATION_MSOFFICE_XLAM
public static final MediaType APPLICATION_MSOFFICE_XLSB
public static final MediaType APPLICATION_MSOFFICE_XLSM
public static final MediaType APPLICATION_MSOFFICE_XLSX
public static final MediaType APPLICATION_MSOFFICE_XLTM
public static final MediaType APPLICATION_MSOFFICE_XLTX
public static final MediaType APPLICATION_OCTET_STREAM
public static final MediaType APPLICATION_OPENOFFICE_ODB
public static final MediaType APPLICATION_OPENOFFICE_ODC
public static final MediaType APPLICATION_OPENOFFICE_ODF
public static final MediaType APPLICATION_OPENOFFICE_ODG
public static final MediaType APPLICATION_OPENOFFICE_ODI
public static final MediaType APPLICATION_OPENOFFICE_ODM
public static final MediaType APPLICATION_OPENOFFICE_ODP
public static final MediaType APPLICATION_OPENOFFICE_ODS
public static final MediaType APPLICATION_OPENOFFICE_ODT
public static final MediaType APPLICATION_OPENOFFICE_OTG
public static final MediaType APPLICATION_OPENOFFICE_OTH
public static final MediaType APPLICATION_OPENOFFICE_OTP
public static final MediaType APPLICATION_OPENOFFICE_OTS
public static final MediaType APPLICATION_OPENOFFICE_OTT
public static final MediaType APPLICATION_OPENOFFICE_OXT
public static final MediaType APPLICATION_PDF
public static final MediaType APPLICATION_POSTSCRIPT
public static final MediaType APPLICATION_POWERPOINT
public static final MediaType APPLICATION_PROJECT
public static final MediaType APPLICATION_RDF_TRIG
public static final MediaType APPLICATION_RDF_TRIX
@Deprecated public static final MediaType APPLICATION_RDF_TURTLE
TEXT_TURTLE
media type.public static final MediaType APPLICATION_RDF_XML
public static final MediaType APPLICATION_RELAXNG_COMPACT
public static final MediaType APPLICATION_RELAXNG_XML
public static final MediaType APPLICATION_RSS
public static final MediaType APPLICATION_RTF
public static final MediaType APPLICATION_SDP
public static final MediaType APPLICATION_SPARQL_RESULTS_JSON
public static final MediaType APPLICATION_SPARQL_RESULTS_XML
public static final MediaType APPLICATION_SPSS_SAV
public static final MediaType APPLICATION_SPSS_SPS
public static final MediaType APPLICATION_STATA_STA
public static final MediaType APPLICATION_STUFFIT
public static final MediaType APPLICATION_TAR
public static final MediaType APPLICATION_TEX
public static final MediaType APPLICATION_TROFF_MAN
public static final MediaType APPLICATION_VOICEXML
public static final MediaType APPLICATION_W3C_SCHEMA
public static final MediaType APPLICATION_W3C_XSLT
public static final MediaType APPLICATION_WADL
public static final MediaType APPLICATION_WORD
public static final MediaType APPLICATION_WWW_FORM
public static final MediaType APPLICATION_XHTML
public static final MediaType APPLICATION_XMI
public static final MediaType APPLICATION_XML
public static final MediaType APPLICATION_XML_DTD
public static final MediaType APPLICATION_XQUERY
public static final MediaType APPLICATION_XUL
public static final MediaType APPLICATION_YAML
public static final MediaType APPLICATION_ZIP
public static final MediaType AUDIO_ALL
public static final MediaType AUDIO_BASIC
public static final MediaType AUDIO_MIDI
public static final MediaType AUDIO_MPEG
public static final MediaType AUDIO_REAL
public static final MediaType AUDIO_WAV
public static final MediaType IMAGE_ALL
public static final MediaType IMAGE_BMP
public static final MediaType IMAGE_GIF
public static final MediaType IMAGE_ICON
public static final MediaType IMAGE_JPEG
public static final MediaType IMAGE_PNG
public static final MediaType IMAGE_SVG
public static final MediaType IMAGE_TIFF
public static final MediaType MESSAGE_ALL
public static final MediaType MESSAGE_HTTP
public static final MediaType MODEL_ALL
public static final MediaType MODEL_VRML
public static final MediaType MULTIPART_ALL
public static final MediaType MULTIPART_FORM_DATA
public static final MediaType TEXT_ALL
public static final MediaType TEXT_CALENDAR
public static final MediaType TEXT_CSS
public static final MediaType TEXT_CSV
public static final MediaType TEXT_DAT
public static final MediaType TEXT_HTML
public static final MediaType TEXT_J2ME_APP_DESCRIPTOR
public static final MediaType TEXT_JAVASCRIPT
public static final MediaType TEXT_PLAIN
public static final MediaType TEXT_RDF_N3
public static final MediaType TEXT_RDF_NTRIPLES
public static final MediaType TEXT_TSV
public static final MediaType TEXT_TURTLE
public static final MediaType TEXT_URI_LIST
public static final MediaType TEXT_VCARD
public static final MediaType TEXT_XML
public static final MediaType TEXT_YAML
public static final MediaType VIDEO_ALL
public static final MediaType VIDEO_AVI
public static final MediaType VIDEO_MP4
public static final MediaType VIDEO_MPEG
public static final MediaType VIDEO_QUICKTIME
public static final MediaType VIDEO_WMV
public MediaType(java.lang.String name)
name
- The name.public MediaType(java.lang.String name, Series<Parameter> parameters)
name
- The name.parameters
- The list of parameters.public MediaType(java.lang.String name, Series<Parameter> parameters, java.lang.String description)
name
- The name.parameters
- The list of parameters.description
- The description.public MediaType(java.lang.String name, java.lang.String description)
name
- The name.description
- The description.public static MediaType getMostSpecific(MediaType... mediaTypes) throws java.lang.IllegalArgumentException
MediaType
s.
Examples:
mediaTypes
- An array of media types.java.lang.IllegalArgumentException
- If the array is null or empty.public static MediaType register(java.lang.String name, java.lang.String description)
valueOf(String)
. If the type already exists, the existing type
is returned, otherwise a new instance is created.name
- The name.description
- The description.public static MediaType valueOf(java.lang.String name)
name
- The name.public boolean equals(java.lang.Object obj, boolean ignoreParameters)
obj
- The object to compare to.ignoreParameters
- Indicates if parameters should be ignored during comparison.public java.lang.String getMainType()
public Series<Parameter> getParameters()
public MediaType getParent()
ALL
media type if it is already
the ALL
media type, or null.public java.lang.String getSubType()
public boolean includes(Metadata included)
includes(Metadata, boolean)
. It ignores the parameters.includes
in class Metadata
included
- The media type to test for inclusion.Metadata.isCompatible(Metadata)
public boolean includes(Metadata included, boolean ignoreParameters)
includes(Metadata, boolean)
. The test is true if both types are
equal or if the given media type is within the range of the current one.
For example, ALL includes all media types. Parameters are ignored for
this comparison. A null media type is considered as included into the
current one. It ignores the parameters.
Examples:
included
- The media type to test for inclusion.Metadata.isCompatible(Metadata)
public boolean isConcrete()
Copyright © 2005-2024 Restlet.