| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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.
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 |
getParameter(String name) 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(ContentType cType) 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 |
toString() Retrieve a RFC2045 style string representation of this Content-Type. |
Constructor Detail |
---|
public ContentType()
public ContentType(String s) throws ParseException
s
- the Content-Type string.ParseException
- if the parse fails.public ContentType(String primaryType, String subType, ParameterList list)
primaryType
- primary typesubType
- subTypelist
- ParameterListMethod Detail |
---|
public String getBaseType()
public String getParameter(String name)
null
if this parameter is absent.
name
public ParameterList getParameterList()
public String getPrimaryType()
public String getSubType()
public 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(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
public void setParameter(String name, String value)
name
- parameter namevalue
- parameter valuepublic void setParameterList(ParameterList list)
list
- ParameterListpublic void setPrimaryType(String primaryType)
primaryType
- primary typepublic void setSubType(String subType)
subType
- the subTypepublic String toString()
null
if
the conversion failed.
toString
in class Object
| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |