Home » apache-tomcat-6.0.26-src » javax » mail » internet » [javadoc | source]
javax.mail.internet
public class: ContentType [javadoc | source]
java.lang.Object
   javax.mail.internet.ContentType
This class represents a MIME ContentType value. It provides methods to parse a ContentType string into individual components and to generate a MIME style ContentType string.
Constructor:
 public ContentType() 
 public ContentType(String s) throws ParseException 
    Constructor that takes a Content-Type string. The String is parsed into its constituents: primaryType, subType and parameters. A ParseException is thrown if the parse fails.
    Parameters:
    s - the Content-Type string.
    Throws:
    ParseException - if the parse fails.
    exception: ParseException - if the parse fails.
 public ContentType(String primaryType,
    String subType,
    ParameterList list) 
    Constructor.
    Parameters:
    primaryType - primary type
    subType - subType
    list - ParameterList
Method from javax.mail.internet.ContentType Summary:
getBaseType,   getParameter,   getParameterList,   getPrimaryType,   getSubType,   match,   match,   setParameter,   setParameterList,   setPrimaryType,   setSubType,   toString
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from javax.mail.internet.ContentType Detail:
 public String getBaseType() 
    Return the MIME type string, without the parameters. The returned value is basically the concatenation of the primaryType, the '/' character and the secondaryType.
 public String getParameter(String name) 
    Return the specified parameter value. Returns null if this parameter is absent.
 public ParameterList getParameterList() 
    Return a ParameterList object that holds all the available parameters. Returns null if no parameters are available.
 public String getPrimaryType() 
    Return the primary type.
 public String getSubType() 
    Return the subType.
 public boolean match(ContentType cType) 
    Match with the specified ContentType object. This method compares only the primaryType and subType . The parameters of both operands are ignored.

    For example, this method will return true when comparing the ContentTypes for "text/plain" and "text/plain; charset=foobar". If the subType of either operand is the special character '*', then the subtype is ignored during the match. For example, this method will return true when comparing the ContentTypes for "text/plain" and "text/*"

 public boolean match(String s) 
    Match with the specified content-type string. This method compares only the primaryType and subType . The parameters of both operands are ignored.

    For example, this method will return true when comparing the ContentType for "text/plain" with "text/plain; charset=foobar". If the subType of either operand is the special character '*', then the subtype is ignored during the match. For example, this method will return true when comparing the ContentType for "text/plain" with "text/*"

 public  void setParameter(String name,
    String value) 
    Set the specified parameter. If this parameter already exists, it is replaced by this new value.
 public  void setParameterList(ParameterList list) 
    Set a new ParameterList.
 public  void setPrimaryType(String primaryType) 
    Set the primary type. Overrides existing primary type.
 public  void setSubType(String subType) 
    Set the subType. Replaces the existing subType.
 public String toString() 
    Retrieve a RFC2045 style string representation of this Content-Type. Returns null if the conversion failed.