Class w3c.mime.MIMEType
All Packages Class Hierarchy This Package Previous Next Index
Class w3c.mime.MIMEType
java.lang.Object
|
+----w3c.mime.MIMEType
- public class MIMEType
- extends Object
This class is used to represent parsed MIME types.
It creates this representation from a string based representation of
the MIME type, as defined in the RFC 1345.
-
APPLICATION_POSTSCRIPT
-
-
APPLICATION_X_JAVA_AGENT
-
-
APPLICATION_X_WWW_FORM_URLENCODED
-
-
external
-
-
level
-
-
MATCH_EXACT_LEVEL
-
-
MATCH_EXACT_SUBTYPE
-
-
MATCH_EXACT_TYPE
-
-
MATCH_EXACT_VERSION
-
-
MATCH_LEVEL
-
-
MATCH_SUBTYPE
-
-
MATCH_TYPE
-
-
MATCH_VERSION
-
-
MULTIPART_FORM_DATA
-
-
parameters
-
-
subtype
-
-
TEXT_HTML
-
-
TEXT_HTML_V2
-
-
TEXT_HTML_V3
-
List of well known MIME types:
-
TEXT_PLAIN
-
-
type
-
-
version
-
-
MIMEType(String)
- Construct MIMEType object for the given string.
-
getParameterValue(String)
- Get a mime type parameter value.
-
hasParameter(String)
- Does this MIME type has some value for the given parameter ?
-
main(String[])
-
-
match(MIMEType)
- How good the given MIMEType matches the receiver of the method ?
This method returns a matching level among:
- TYPE
- Types match, through wildcards,
- EXACT_TYPE
- Types match exactly,
- SUBTYPE
- Types match, subtypes match through wildcards,
- EXACT_SUBTYPE
- Types and subtypes match exactly,
- VERSION
- Types and subtypes match, version ok
- EXACT_VERSION
- Types and subtypes match, versions equal
- LEVEL
- Types and subtypes match versions and level ok,
- EXACT_LEVEL
- Types and subtypes match, versions and levels equals
-
toString()
- A printable representation of this MIMEType.
TEXT_HTML_V3
public static MIMEType TEXT_HTML_V3
- List of well known MIME types:
TEXT_HTML_V2
public static MIMEType TEXT_HTML_V2
TEXT_HTML
public static MIMEType TEXT_HTML
APPLICATION_POSTSCRIPT
public static MIMEType APPLICATION_POSTSCRIPT
TEXT_PLAIN
public static MIMEType TEXT_PLAIN
APPLICATION_X_WWW_FORM_URLENCODED
public static MIMEType APPLICATION_X_WWW_FORM_URLENCODED
MULTIPART_FORM_DATA
public static MIMEType MULTIPART_FORM_DATA
APPLICATION_X_JAVA_AGENT
public static MIMEType APPLICATION_X_JAVA_AGENT
MATCH_TYPE
public final int MATCH_TYPE
MATCH_EXACT_TYPE
public final int MATCH_EXACT_TYPE
MATCH_SUBTYPE
public final int MATCH_SUBTYPE
MATCH_EXACT_SUBTYPE
public final int MATCH_EXACT_SUBTYPE
MATCH_VERSION
public final int MATCH_VERSION
MATCH_EXACT_VERSION
public final int MATCH_EXACT_VERSION
MATCH_LEVEL
public final int MATCH_LEVEL
MATCH_EXACT_LEVEL
public final int MATCH_EXACT_LEVEL
type
protected String type
subtype
protected String subtype
version
protected double version
level
protected int level
parameters
protected MIMETypeParameter parameters[]
external
protected String external
MIMEType
public MIMEType(String spec) throws MIMETypeFormatException
- Construct MIMEType object for the given string.
The string should be the representation of the type. This methods
tries to be compliant with HTTP1.1, p 15, although it is not
(because of quoted-text not being accepted).
FIXME
- Parameters:
- eter - spec A string representing a MIMEType
- Returns:
- A MIMEType object
- Throws: MIMETypeFormatException,
- if the string couldn't be parsed.
match
public int match(MIMEType other)
- How good the given MIMEType matches the receiver of the method ?
This method returns a matching level among:
- TYPE
- Types match, through wildcards,
- EXACT_TYPE
- Types match exactly,
- SUBTYPE
- Types match, subtypes match through wildcards,
- EXACT_SUBTYPE
- Types and subtypes match exactly,
- VERSION
- Types and subtypes match, version ok
- EXACT_VERSION
- Types and subtypes match, versions equal
- LEVEL
- Types and subtypes match versions and level ok,
- EXACT_LEVEL
- Types and subtypes match, versions and levels equals
- Parameters:
- other - The other MIMEType to match against ourself.
toString
public String toString()
- A printable representation of this MIMEType.
The printed representation is guaranteed to be parseable by the
String constructor.
- Overrides:
- toString in class Object
hasParameter
public boolean hasParameter(String name)
- Does this MIME type has some value for the given parameter ?
- Parameters:
- name - The parameter to check.
- Returns:
- True if this parameter has a value, false
otherwise.
getParameterValue
public String getParameterValue(String name)
- Get a mime type parameter value.
- Parameters:
- name - The parameter whose value is to be returned.
- Returns:
- The parameter value, or null if not found.
main
public static void main(String args[])
All Packages Class Hierarchy This Package Previous Next Index