public class MediaType extends Object
Modifier and Type | Field and Description |
---|---|
protected Map<String,String> |
parameters
Parameters (ie "charset"="utf-8")
|
protected static Pattern |
RE_PARAMETERS |
protected static Pattern |
RE_TYPE |
protected String |
subtype
Sub-type (ie "html").
|
protected String |
type
Primary type (ie "text").
|
Constructor and Description |
---|
MediaType() |
MediaType(String mediaType) |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Reset everything to null.
|
String |
getCharset()
Character encoding (ie "utf-8")
|
String |
getParameter(String name)
Return the parameter value for the specified parameter.
|
String |
getSubtype()
Sub-type (ie "html").
|
String |
getType()
Primary type (ie "text").
|
Set<String> |
listParameterNames()
List the parameter names (ie "charset").
|
void |
parse(String s) |
void |
removeParameter(String name)
Remove the specified parameter.
|
void |
setCharset(String charset)
Character encoding (ie "utf-8")
|
void |
setParameter(String name,
String value)
Set the specified parameter.
|
void |
setSubtype(String subtype)
Sub-type (ie "html").
|
void |
setType(String type)
Primary type (ie "text").
|
String |
toString()
Return full media-type (ie "text/html; charset=utf-8").
|
protected static final Pattern RE_TYPE
protected static final Pattern RE_PARAMETERS
protected String type
protected String subtype
public MediaType()
public MediaType(String mediaType)
public String toString()
public void parse(String s)
public void clear()
public String getType()
public void setType(String type)
public String getSubtype()
public void setSubtype(String subtype)
public String getCharset()
public void setCharset(String charset)
public String getParameter(String name)
public void setParameter(String name, String value)
public void removeParameter(String name)