Package javax.mail.internet
Class ContentType
- java.lang.Object
-
- javax.mail.internet.ContentType
-
public class ContentType extends java.lang.ObjectA MIME Content-Type value.- Version:
- 1.4
- Author:
- Chris Burdess
-
-
Constructor Summary
Constructors Constructor Description ContentType()Constructor for an empty Content-Type.ContentType(java.lang.String s)Constructor that parses a Content-Type value from an RFC 2045 string representation.ContentType(java.lang.String primaryType, java.lang.String subType, ParameterList list)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetBaseType()Returns the MIME type string, without the parameters.java.lang.StringgetParameter(java.lang.String name)Returns the specified parameter value.ParameterListgetParameterList()Returns the parameters.java.lang.StringgetPrimaryType()Returns the primary type.java.lang.StringgetSubType()Returns the subtype.booleanmatch(java.lang.String s)Returns true if the specified Content-Type matches this Content-Type.booleanmatch(ContentType cType)Returns true if the specified Content-Type matches this Content-Type.voidsetParameter(java.lang.String name, java.lang.String value)Sets the specified parameter.voidsetParameterList(ParameterList list)Sets the parameters.voidsetPrimaryType(java.lang.String primaryType)Sets the primary type.voidsetSubType(java.lang.String subType)Sets the subtype.java.lang.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(java.lang.String primaryType, java.lang.String subType, ParameterList list)Constructor.- Parameters:
primaryType- the primary typesubType- the subtypelist- the parameters
-
ContentType
public ContentType(java.lang.String s) throws ParseExceptionConstructor 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
-
getPrimaryType
public java.lang.String getPrimaryType()
Returns the primary type.
-
getSubType
public java.lang.String getSubType()
Returns the subtype.
-
getBaseType
public java.lang.String getBaseType()
Returns the MIME type string, without the parameters.
-
getParameter
public java.lang.String getParameter(java.lang.String name)
Returns the specified parameter value.
-
getParameterList
public ParameterList getParameterList()
Returns the parameters.
-
setPrimaryType
public void setPrimaryType(java.lang.String primaryType)
Sets the primary type.
-
setSubType
public void setSubType(java.lang.String subType)
Sets the subtype.
-
setParameter
public void setParameter(java.lang.String name, java.lang.String value)Sets the specified parameter.- Parameters:
name- the parameter namevalue- the parameter value
-
setParameterList
public void setParameterList(ParameterList list)
Sets the parameters.- Parameters:
list- the Parameter list
-
toString
public java.lang.String toString()
Returns an RFC 2045 string representation of this Content-Type.- Overrides:
toStringin classjava.lang.Object
-
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(java.lang.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
-
-