org.apache.any23.mime
Class MIMEType

java.lang.Object
  extended by 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
 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 of MIMEType.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

parse

public static MIMEType parse(String mimeType)
Parses the given MIME type string returning an instance of MIMEType. The expected format for mimeType is type/subtype[;q=x.y] . An example of valid mime type is: application/rdf+xml;q=0.9

Parameters:
mimeType -
Returns:
the mime type instance.
Throws:
IllegalArgumentException - if the mimeType 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()

toString

public String toString()
Overrides:
toString in class Object

compareTo

public int compareTo(MIMEType other)
Specified by:
compareTo in interface Comparable<MIMEType>


Copyright © 2010-2012 The Apache Software Foundation. All Rights Reserved.