|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.norther.tammi.acorn.mime.MimeType
public class MimeType
MimeType is used to represent parsed MIME types. The representation is parsed from a string based representation of the MIME type, as defined in the RFC1345.
| Field Summary | |
|---|---|
static String |
ANY_APPLICATION
Any application type as a string. |
static String |
ANY_TEXT
Any text type as a string. |
static String |
ANY_TYPE
The wildcard. |
static String |
APPLICATION_OCTET_STREAM
Octet stream type as a string. |
static MimeType |
APPLICATION_OCTET_STREAM_TYPE
Octet stream type. |
static String |
APPLICATION_POSTSCRIPT
PostScript type as a string. |
static MimeType |
APPLICATION_POSTSCRIPT_TYPE
PostScript type. |
static MimeType |
APPLICATION_TYPE
Any application type. |
static String |
APPLICATION_X_JAVA_AGENT
Java agent type as a string. |
static MimeType |
APPLICATION_X_JAVA_AGENT_TYPE
Java agent type. |
static String |
APPLICATION_X_WWW_FORM_URLENCODED
WWW form type as a string. |
static MimeType |
APPLICATION_X_WWW_FORM_URLENCODED_TYPE
WWW form type. |
static String |
APPLICATION_XHTML
XHTML type as a string. |
static MimeType |
APPLICATION_XHTML_TYPE
XHTML type. |
static String |
CHTML
Extension .chtml. |
static String |
DEFAULT
The default type as a string. |
static MimeType |
DEFAULT_TYPE
The default type. |
static String |
GIF
Extension .gif. |
static String |
HDM
Extension .hdm. |
static String |
HDML
Extension .hdml. |
static String |
HTM
Extension .htm. |
static String |
HTML
Extension .html. |
static String |
IMAGE_GIF
GIF type as a string. |
static MimeType |
IMAGE_GIF_TYPE
GIF type. |
static String |
IMAGE_JPEG
JPEG type as a string. |
static MimeType |
IMAGE_JPEG_TYPE
JPEG type. |
static String |
IMAGE_WBMP
WBMP type as a string. |
static MimeType |
IMAGE_WBMP_TYPE
WBMP type. |
static String |
JPEG
Extension .jpeg. |
static String |
JPG
Extension .jpg. |
static int |
MATCH_SPECIFIC_SUBTYPE
Match specific subtype. |
static int |
MATCH_SUBTYPE
Match subtype. |
static int |
MATCH_TYPE
Match main type. |
static String |
MESSAGE_HTTP
HTTP message type as a string. |
static MimeType |
MESSAGE_HTTP_TYPE
HTTP Message type. |
static String |
MULTIPART
Multipart type as a string. |
static String |
MULTIPART_FORM_DATA
HTML form data type as a string. |
static MimeType |
MULTIPART_FORM_DATA_TYPE
HTML form data type. |
static MimeType |
MULTIPART_TYPE
Multipart type. |
static int |
NO_MATCH
No type match. |
static String |
SMS
Extension .sms. |
static String |
TEXT_CSS
CSS type as a string. |
static MimeType |
TEXT_CSS_TYPE
CSS type. |
static String |
TEXT_HDML
XHDML type as a string. |
static MimeType |
TEXT_HDML_TYPE
HDML type. |
static String |
TEXT_HTML
HTML type as a string. |
static MimeType |
TEXT_HTML_TYPE
HTML type. |
static String |
TEXT_PLAIN
Plain text type as a string. |
static MimeType |
TEXT_PLAIN_TYPE
Plain text type. |
static MimeType |
TEXT_TYPE
Any text type. |
static String |
TEXT_WML
WML type as a string. |
static MimeType |
TEXT_WML_TYPE
WML type. |
static String |
TXT
Extension .txt. |
static String |
WBMP
Extension .wbmp. |
static String |
WML
Extension .wml. |
static String |
XHTML
Extension .xhtml. |
| Constructor Summary | |
|---|---|
MimeType(String spec)
Constructs a new MIME type by parsing a specification string. |
|
MimeType(String spec,
boolean parsep)
Constructs a new MIME type by parsing a specification string. |
|
MimeType(String type,
String subtype)
Contructs a new MIME type from specified types. |
|
MimeType(String type,
String subtype,
String[] names,
String[] values)
Contructs a new MIME type from specified parameters. |
|
| Method Summary | |
|---|---|
void |
addParameter(String param,
String value)
Adds a parameter to the MIME type. |
void |
addParameters(String[] params,
String[] values)
Adds parameters to the MIME type. |
Object |
clone()
Clones this object. |
boolean |
containsParameter(String param)
Checks whether the MIME type contains the specified parameter. |
String |
getParameter(String param)
Gets the value of a MIME type parameter. |
String |
getSubtype()
Gets the subtype of the MIME type. |
String |
getType()
Gets the main type of the MIME type. |
int |
match(MimeType other)
Compares the specified MIME type to this one and returns a matching level: NO_MATCH=types do not match, MATCH=types match, MATCH_SPECIFIC=types match exactly, MATCH_SUBTYPE=types match, subtypes match too, MATCH_SPECIFIC_SUBTYPE=types match, subtypes match exactly. |
int |
match(String other)
Compares the specified MIME string to this one and returns a matching level: NO_MATCH=types do not match, MATCH=types match, MATCH_SPECIFIC=types match exactly, MATCH_SUBTYPE=types match, subtypes match too, MATCH_SPECIFIC_SUBTYPE=types match, subtypes match exactly. |
void |
removeParameter(String param)
Removes a parameter from the MIME type. |
void |
setParameter(String param,
String value)
Sets the value of a MIME type parameter replacing the old one. |
String |
toString()
Converts the MIME type into a string. |
String |
toString(boolean params)
Converts the MIME type into a string with or without parameters. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String ANY_TYPE
public static final String HTML
public static final String HTM
public static final String WML
public static final String HDML
public static final String HDM
public static final String CHTML
public static final String XHTML
public static final String TXT
public static final String GIF
public static final String JPEG
public static final String JPG
public static final String WBMP
public static final String SMS
public static final String TEXT_HTML
public static final String TEXT_WML
public static final String TEXT_HDML
public static final String TEXT_PLAIN
public static final String MULTIPART
public static final String MULTIPART_FORM_DATA
public static final String APPLICATION_XHTML
public static final String APPLICATION_POSTSCRIPT
public static final String APPLICATION_OCTET_STREAM
public static final String APPLICATION_X_JAVA_AGENT
public static final String APPLICATION_X_WWW_FORM_URLENCODED
public static final String MESSAGE_HTTP
public static final String TEXT_CSS
public static final String ANY_TEXT
public static final String IMAGE_GIF
public static final String IMAGE_JPEG
public static final String IMAGE_WBMP
public static final String ANY_APPLICATION
public static final String DEFAULT
public static final MimeType TEXT_HTML_TYPE
public static final MimeType TEXT_WML_TYPE
public static final MimeType TEXT_HDML_TYPE
public static final MimeType TEXT_PLAIN_TYPE
public static final MimeType MULTIPART_TYPE
public static final MimeType MULTIPART_FORM_DATA_TYPE
public static final MimeType APPLICATION_XHTML_TYPE
public static final MimeType APPLICATION_POSTSCRIPT_TYPE
public static final MimeType APPLICATION_OCTET_STREAM_TYPE
public static final MimeType APPLICATION_X_JAVA_AGENT_TYPE
public static final MimeType APPLICATION_X_WWW_FORM_URLENCODED_TYPE
public static final MimeType MESSAGE_HTTP_TYPE
public static final MimeType TEXT_CSS_TYPE
public static final MimeType TEXT_TYPE
public static final MimeType IMAGE_GIF_TYPE
public static final MimeType IMAGE_JPEG_TYPE
public static final MimeType IMAGE_WBMP_TYPE
public static final MimeType APPLICATION_TYPE
public static final MimeType DEFAULT_TYPE
public static final int NO_MATCH
public static final int MATCH_TYPE
public static final int MATCH_SUBTYPE
public static final int MATCH_SPECIFIC_SUBTYPE
| Constructor Detail |
|---|
public MimeType(String spec)
spec - a string representing a MIME type.
IllegalArgumentException - for parsing errors.
public MimeType(String spec,
boolean parsep)
spec - a string representing a MIME type.parsep - a flag for parsing parameters also.
IllegalArgumentException - for parsing errors.
public MimeType(String type,
String subtype)
type - a type.subtype - a subtype.
NullPointerException - if type or subtype are nulls.
public MimeType(String type,
String subtype,
String[] names,
String[] values)
type - a type.subtype - a subtype.names - parameters names.values - parameter values.
NullPointerException - if type or subtype are nulls.| Method Detail |
|---|
public Object clone()
clone in class Objectpublic int match(MimeType other)
other - the MimeType to compare.
public int match(String other)
other - the MIME string to compare.
public String getType()
public String getSubtype()
public boolean containsParameter(String param)
param - the name opf the parameter.
public String getParameter(String param)
param - the name of the parameter.
public void setParameter(String param,
String value)
param - the name of the parameter.value - the value of the parameter.
public void addParameter(String param,
String value)
param - the name of the parameter.value - the value of the parameter.
public void addParameters(String[] params,
String[] values)
params - an array of parameter names.values - an array of parameter values.
IllegalArgumentException - for incorrect parameters.public void removeParameter(String param)
param - the name of the parameter.public String toString()
toString in class Objectpublic String toString(boolean params)
params - if true, include parameters.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||