public class ContentType
extends java.lang.Object
| Constructor and Description | 
|---|
ContentType()
No-arg Constructor. 
 | 
ContentType(java.lang.String s)
Constructor that takes a Content-Type string. 
 | 
ContentType(java.lang.String primaryType,
           java.lang.String subType,
           ParameterList list)
Constructor. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
java.lang.String | 
getBaseType()
Return the MIME type string, without the parameters. 
 | 
java.lang.String | 
getParameter(java.lang.String name)
Return the specified parameter value. 
 | 
ParameterList | 
getParameterList()
Return a ParameterList object that holds all the available 
 parameters. 
 | 
java.lang.String | 
getPrimaryType()
Return the primary type. 
 | 
java.lang.String | 
getSubType()
Return the subType. 
 | 
boolean | 
match(ContentType cType)
Match with the specified ContentType object. 
 | 
boolean | 
match(java.lang.String s)
Match with the specified content-type string. 
 | 
void | 
setParameter(java.lang.String name,
            java.lang.String value)
Set the specified parameter. 
 | 
void | 
setParameterList(ParameterList list)
Set a new ParameterList. 
 | 
void | 
setPrimaryType(java.lang.String primaryType)
Set the primary type. 
 | 
void | 
setSubType(java.lang.String subType)
Set the subType. 
 | 
java.lang.String | 
toString()
Retrieve a RFC2045 style string representation of
 this Content-Type. 
 | 
public ContentType()
public ContentType(java.lang.String primaryType,
                   java.lang.String subType,
                   ParameterList list)
primaryType - primary typesubType - subTypelist - ParameterListpublic ContentType(java.lang.String s)
            throws ParseException
s - the Content-Type string.ParseException - if the parse fails.public java.lang.String getPrimaryType()
public java.lang.String getSubType()
public java.lang.String getBaseType()
public java.lang.String getParameter(java.lang.String name)
null
 if this parameter is absent.name - the parameter namepublic ParameterList getParameterList()
public void setPrimaryType(java.lang.String primaryType)
primaryType - primary typepublic void setSubType(java.lang.String subType)
subType - the subTypepublic void setParameter(java.lang.String name,
                         java.lang.String value)
name - parameter namevalue - parameter valuepublic void setParameterList(ParameterList list)
list - ParameterListpublic java.lang.String toString()
toString in class java.lang.Objectpublic boolean match(ContentType cType)
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/*" 
cType - ContentType to compare this againstpublic boolean match(java.lang.String s)
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/*" 
s - the content-type string to matchCopyright © 2010 - 2023 Adobe. All Rights Reserved