Package org.apache.any23.mime
Class MIMEType
- java.lang.Object
-
- org.apache.any23.mime.MIMEType
-
- All Implemented Interfaces:
Comparable<MIMEType>
public class MIMEType extends Object implements Comparable<MIMEType>
A MIME type with an optional q (quality) value.- Author:
- Richard Cyganiak (richard@cyganiak.de)
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(MIMEType other)
String
getFullType()
String
getMajorType()
double
getQuality()
String
getSubtype()
boolean
isAnyMajorType()
boolean
isAnySubtype()
static MIMEType
parse(String mimeType)
Parses the given MIME type string returning an instance ofMIMEType
.String
toString()
-
-
-
Method Detail
-
parse
public static MIMEType parse(String mimeType)
Parses the given MIME type string returning an instance ofMIMEType
. The expected format formimeType
istype/subtype[;q=x.y]
. An example of valid mime type is:application/rdf+xml;q=0.9
- Parameters:
mimeType
- a provided mimetype string.- Returns:
- the mime type instance.
- Throws:
IllegalArgumentException
- if themimeType
is not well formatted.
-
getMajorType
public String getMajorType()
-
getSubtype
public String getSubtype()
-
getFullType
public String getFullType()
-
getQuality
public double getQuality()
-
isAnyMajorType
public boolean isAnyMajorType()
-
isAnySubtype
public boolean isAnySubtype()
-
compareTo
public int compareTo(MIMEType other)
- Specified by:
compareTo
in interfaceComparable<MIMEType>
-
-