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 intcompareTo(MIMEType other)StringgetFullType()StringgetMajorType()doublegetQuality()StringgetSubtype()booleanisAnyMajorType()booleanisAnySubtype()static MIMETypeparse(String mimeType)Parses the given MIME type string returning an instance ofMIMEType.StringtoString()
-
-
-
Method Detail
-
parse
public static MIMEType parse(String mimeType)
Parses the given MIME type string returning an instance ofMIMEType. The expected format formimeTypeistype/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 themimeTypeis 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:
compareToin interfaceComparable<MIMEType>
-
-