javax.mail.internet

Class ContentType

public class ContentType extends Object

A MIME Content-Type value.

Version: 1.3

Author: Chris Burdess

Constructor Summary
ContentType()
Constructor for an empty Content-Type.
ContentType(String primaryType, String subType, ParameterList list)
Constructor.
ContentType(String s)
Constructor that parses a Content-Type value from an RFC 2045 string representation.
Method Summary
StringgetBaseType()
Returns the MIME type string, without the parameters.
StringgetParameter(String name)
Returns the specified parameter value.
ParameterListgetParameterList()
Returns the parameters.
StringgetPrimaryType()
Returns the primary type.
StringgetSubType()
Returns the subtype.
booleanmatch(ContentType cType)
Returns true if the specified Content-Type matches this Content-Type.
booleanmatch(String s)
Returns true if the specified Content-Type matches this Content-Type.
voidsetParameter(String name, String value)
Sets the specified parameter.
voidsetParameterList(ParameterList list)
Sets the parameters.
voidsetPrimaryType(String primaryType)
Sets the primary type.
voidsetSubType(String subType)
Sets the subtype.
StringtoString()
Returns an RFC 2045 string representation of this Content-Type.

Constructor Detail

ContentType

public ContentType()
Constructor for an empty Content-Type.

ContentType

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

Parameters: primaryType the primary type subType the subtype list the parameters

ContentType

public ContentType(String s)
Constructor that parses a Content-Type value from an RFC 2045 string representation.

Parameters: s the Content-Type value

Throws: ParseException if an error occurred during parsing

Method Detail

getBaseType

public String getBaseType()
Returns the MIME type string, without the parameters.

getParameter

public String getParameter(String name)
Returns the specified parameter value.

getParameterList

public ParameterList getParameterList()
Returns the parameters.

getPrimaryType

public String getPrimaryType()
Returns the primary type.

getSubType

public String getSubType()
Returns the subtype.

match

public boolean match(ContentType cType)
Returns true if the specified Content-Type matches this Content-Type. Parameters are ignored.

If the subtype of either Content-Type is the special character '*', the subtype is ignored during the match.

Parameters: cType the Content-Type for comparison

match

public boolean match(String s)
Returns true if the specified Content-Type matches this Content-Type. Parameters are ignored.

If the subtype of either Content-Type is the special character '*', the subtype is ignored during the match.

Parameters: s the RFC 2045 string representation of the Content-Type to match

setParameter

public void setParameter(String name, String value)
Sets the specified parameter.

Parameters: name the parameter name value the parameter value

setParameterList

public void setParameterList(ParameterList list)
Sets the parameters.

Parameters: list the Parameter list

setPrimaryType

public void setPrimaryType(String primaryType)
Sets the primary type.

setSubType

public void setSubType(String subType)
Sets the subtype.

toString

public String toString()
Returns an RFC 2045 string representation of this Content-Type.
© Copyright 2003, 2004 The Free Software Foundation, All rights reserved