This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


javax.mail.internet
class ContentType

javax.mail.internet.ContentType

Most common way to construct:

ContentType apContentType = new ContentType("multipart/related");

Based on 6 examples


public class ContentType
extends Object

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.

See Also (auto-generated):

Session

Properties

Transport


Constructor Summary

          No-arg Constructor.

          Constructor that takes a Content-Type string.
ContentType(String primaryType, String subType, ParameterList list)

          Constructor.
 
Method Summary
 String

          Return the MIME type string, without the parameters.
 String

          Return the specified parameter value.
 ParameterList

          Return a ParameterList object that holds all the available parameters.
 String

          Return the primary type.
 String

          Return the subType.
 boolean

          Match with the specified ContentType object.
 boolean

          Match with the specified content-type string.
 void
setParameter(String name, String value)

          Set the specified parameter.
 void

          Set a new ParameterList.
 void
setPrimaryType(String primaryType)

          Set the primary type.
 void
setSubType(String subType)

          Set the subType.
 String

          Retrieve a RFC2045 style string representation of this Content-Type.
 

Constructor Detail

ContentType

public ContentType()
No-arg Constructor.


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.

ContentType

public ContentType(String primaryType,
                   String subType,
                   ParameterList list)
Constructor.

Parameters:
primaryType - primary type
subType - subType
list - ParameterList
Method Detail

getBaseType

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.

Returns:
the type

getParameter

public String getParameter(String name)
Return the specified parameter value. Returns null if this parameter is absent.

Parameters:
name
Returns:
parameter value

getParameterList

public ParameterList getParameterList()
Return a ParameterList object that holds all the available parameters. Returns null if no parameters are available.

Returns:
ParameterList

getPrimaryType

public String getPrimaryType()
Return the primary type.

Returns:
the primary type

getSubType

public String getSubType()
Return the subType.

Returns:
the subType

match

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/*"

Parameters:
cType - ContentType to compare this against

match

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/*"

Parameters:
s

setParameter

public void setParameter(String name,
                         String value)
Set the specified parameter. If this parameter already exists, it is replaced by this new value.

Parameters:
name - parameter name
value - parameter value

setParameterList

public void setParameterList(ParameterList list)
Set a new ParameterList.

Parameters:
list - ParameterList

setPrimaryType

public void setPrimaryType(String primaryType)
Set the primary type. Overrides existing primary type.

Parameters:
primaryType - primary type

setSubType

public void setSubType(String subType)
Set the subType. Replaces the existing subType.

Parameters:
subType - the subType

toString

public String toString()
Retrieve a RFC2045 style string representation of this Content-Type. Returns null if the conversion failed.

Overrides:
toString in class Object
Returns:
RFC2045 style string


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention. The official Sun™ documentation can be found here at http://java.sun.com/products/javamail/javadocs/index.html.