javax.mail.internet
public class ContentType extends Object
Constructor and Description |
---|
ContentType()
Constructor for an empty Content-Type.
|
ContentType(String s)
Constructor that parses a Content-Type value from an RFC 2045 string
representation.
|
ContentType(String primaryType,
String subType,
ParameterList list)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
String |
getBaseType()
Returns the MIME type string, without the parameters.
|
String |
getParameter(String name)
Returns the specified parameter value.
|
ParameterList |
getParameterList()
Returns the parameters.
|
String |
getPrimaryType()
Returns the primary type.
|
String |
getSubType()
Returns the subtype.
|
boolean |
match(ContentType cType)
Returns true if the specified Content-Type matches this Content-Type.
|
boolean |
match(String s)
Returns true if the specified Content-Type matches this Content-Type.
|
void |
setParameter(String name,
String value)
Sets the specified parameter.
|
void |
setParameterList(ParameterList list)
Sets the parameters.
|
void |
setPrimaryType(String primaryType)
Sets the primary type.
|
void |
setSubType(String subType)
Sets the subtype.
|
String |
toString()
Returns an RFC 2045 string representation of this Content-Type.
|
public ContentType()
public ContentType(String primaryType, String subType, ParameterList list)
primaryType
- the primary typesubType
- the subtypelist
- the parameterspublic ContentType(String s) throws ParseException
s
- the Content-Type valueParseException
- if an error occurred during parsingpublic String getPrimaryType()
public String getSubType()
public String getBaseType()
public ParameterList getParameterList()
public void setPrimaryType(String primaryType)
public void setSubType(String subType)
public void setParameter(String name, String value)
name
- the parameter namevalue
- the parameter valuepublic void setParameterList(ParameterList list)
list
- the Parameter listpublic String toString()
public boolean match(ContentType cType)
If the subtype of either Content-Type is the special character '*', the subtype is ignored during the match.
cType
- the Content-Type for comparisonpublic boolean match(String s)
If the subtype of either Content-Type is the special character '*', the subtype is ignored during the match.
s
- the RFC 2045 string representation of the Content-Type to match© Copyright 2003, 2004 The Free Software Foundation, All rights reserved