|
|||||||||
| Home >> All >> org >> apache >> turbine >> services >> mimetype >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.turbine.services.mimetype.util
Class MimeType

java.lang.Objectorg.apache.turbine.services.mimetype.util.MimeType
- All Implemented Interfaces:
- java.lang.Cloneable
- public class MimeType
- extends java.lang.Object
- implements java.lang.Cloneable
- extends java.lang.Object
This class 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.
- Version:
- $Id: MimeType.java 264148 2005-08-29 14:21:04Z henning $
| Constructor Summary | |
MimeType(java.lang.String spec)
Constructs a new MIME type by parsing a specification string. |
|
MimeType(java.lang.String spec,
boolean parsep)
Constructs a new MIME type by parsing a specification string. |
|
MimeType(java.lang.String type,
java.lang.String subtype)
Contructs a new MIME type from specified types. |
|
MimeType(java.lang.String type,
java.lang.String subtype,
java.lang.String[] names,
java.lang.String[] values)
Contructs a new MIME type from specified parameters. |
|
| Method Summary | |
void |
addParameter(java.lang.String param,
java.lang.String value)
Adds a parameter to the MIME type. |
void |
addParameters(java.lang.String[] params,
java.lang.String[] values)
Adds parameters to the MIME type. |
java.lang.String |
getParameter(java.lang.String param)
Gets the value of a MIME type parameter. |
java.lang.String |
getSubtype()
Gets the subtype of the MIME type. |
java.lang.String |
getType()
Gets the main type of the MIME type. |
java.lang.String |
getTypes()
Gets the type and the subtype of the MIME type. |
boolean |
hasParameter(java.lang.String param)
Checks whether the MIME type contains the specified parameter. |
int |
match(MimeType other)
Compares the specified MIME type to this one and returns a matching level: NO_MATCH=types do not match, MATCH_TYPE=types match, MATCH_SPECIFIC_TYPE=types match exactly, MATCH_SUBTYPE=types match, subtypes match too, MATCH_SPECIFIC_SUBTYPE=types match, subtypes match exactly. |
void |
setParameter(java.lang.String param,
java.lang.String value)
Sets the value of a MIME type parameter replacing the old one. |
java.lang.String |
toString()
Converts the MIME type into a string. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
TEXT_HTML
public static MimeType TEXT_HTML
- A list of well known MIME types.
TEXT_WML
public static MimeType TEXT_WML
TEXT_HDML
public static MimeType TEXT_HDML
TEXT_CHTML
public static MimeType TEXT_CHTML
TEXT_PLAIN
public static MimeType TEXT_PLAIN
MULTIPART
public static MimeType MULTIPART
MULTIPART_FORM_DATA
public static MimeType MULTIPART_FORM_DATA
APPLICATION_POSTSCRIPT
public static MimeType APPLICATION_POSTSCRIPT
APPLICATION_OCTET_STREAM
public static MimeType APPLICATION_OCTET_STREAM
APPLICATION_X_JAVA_AGENT
public static MimeType APPLICATION_X_JAVA_AGENT
APPLICATION_X_WWW_FORM_URLENCODED
public static MimeType APPLICATION_X_WWW_FORM_URLENCODED
MESSAGE_HTTP
public static MimeType MESSAGE_HTTP
TEXT_CSS
public static MimeType TEXT_CSS
TEXT
public static MimeType TEXT
IMAGE_GIF
public static MimeType IMAGE_GIF
IMAGE_JPEG
public static MimeType IMAGE_JPEG
IMAGE_WBMP
public static MimeType IMAGE_WBMP
NO_MATCH
public static final int NO_MATCH
- MIME type matching constants.
- See Also:
- Constant Field Values
MATCH_TYPE
public static final int MATCH_TYPE
- See Also:
- Constant Field Values
MATCH_SUBTYPE
public static final int MATCH_SUBTYPE
- See Also:
- Constant Field Values
MATCH_SPECIFIC_SUBTYPE
public static final int MATCH_SPECIFIC_SUBTYPE
- See Also:
- Constant Field Values
mimeType
private java.lang.String mimeType
- A string representation of the main type.
mimeSubtype
private java.lang.String mimeSubtype
- A string representation of the subtype.
parameterNames
private java.lang.String[] parameterNames
- Parameter names.
parameterValues
private java.lang.String[] parameterValues
- Parameter values.
mimeTypeString
private java.lang.String mimeTypeString
- A string representation of the MIME type.
| Constructor Detail |
MimeType
public MimeType(java.lang.String spec)
- Constructs a new MIME type by parsing a specification string.
MimeType
public MimeType(java.lang.String spec, boolean parsep)
- Constructs a new MIME type by parsing a specification string.
MimeType
public MimeType(java.lang.String type, java.lang.String subtype)
- Contructs a new MIME type from specified types.
MimeType
public MimeType(java.lang.String type, java.lang.String subtype, java.lang.String[] names, java.lang.String[] values)
- Contructs a new MIME type from specified parameters.
| Method Detail |
match
public int match(MimeType other)
- Compares the specified MIME type to this one
and returns a matching level:
NO_MATCH=types do not match,
MATCH_TYPE=types match,
MATCH_SPECIFIC_TYPE=types match exactly,
MATCH_SUBTYPE=types match, subtypes match too,
MATCH_SPECIFIC_SUBTYPE=types match, subtypes match exactly.
getType
public java.lang.String getType()
- Gets the main type of the MIME type.
getSubtype
public java.lang.String getSubtype()
- Gets the subtype of the MIME type.
getTypes
public java.lang.String getTypes()
- Gets the type and the subtype of the MIME type.
hasParameter
public boolean hasParameter(java.lang.String param)
- Checks whether the MIME type contains the specified parameter.
getParameter
public java.lang.String getParameter(java.lang.String param)
- Gets the value of a MIME type parameter.
The first parameter with the specifed name will be returned.
setParameter
public void setParameter(java.lang.String param, java.lang.String value)
- Sets the value of a MIME type parameter replacing the old one.
addParameter
public void addParameter(java.lang.String param, java.lang.String value)
- Adds a parameter to the MIME type.
addParameters
public void addParameters(java.lang.String[] params, java.lang.String[] values)
- Adds parameters to the MIME type.
toString
public java.lang.String toString()
- Converts the MIME type into a string.
|
|||||||||
| Home >> All >> org >> apache >> turbine >> services >> mimetype >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.apache.turbine.services.mimetype.util.MimeType