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.

Variable Index

 o APPLICATION_POSTSCRIPT
 o APPLICATION_X_JAVA_AGENT
 o APPLICATION_X_WWW_FORM_URLENCODED
 o external
 o level
 o MATCH_EXACT_LEVEL
 o MATCH_EXACT_SUBTYPE
 o MATCH_EXACT_TYPE
 o MATCH_EXACT_VERSION
 o MATCH_LEVEL
 o MATCH_SUBTYPE
 o MATCH_TYPE
 o MATCH_VERSION
 o MULTIPART_FORM_DATA
 o parameters
 o subtype
 o TEXT_HTML
 o TEXT_HTML_V2
 o TEXT_HTML_V3
List of well known MIME types:
 o TEXT_PLAIN
 o type
 o version

Constructor Index

 o MIMEType(String)
Construct MIMEType object for the given string.

Method Index

 o getParameterValue(String)
Get a mime type parameter value.
 o hasParameter(String)
Does this MIME type has some value for the given parameter ?
 o main(String[])
 o 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
 o toString()
A printable representation of this MIMEType.

Variables

 o TEXT_HTML_V3
  public static MIMEType TEXT_HTML_V3
List of well known MIME types:
 o TEXT_HTML_V2
  public static MIMEType TEXT_HTML_V2
 o TEXT_HTML
  public static MIMEType TEXT_HTML
 o APPLICATION_POSTSCRIPT
  public static MIMEType APPLICATION_POSTSCRIPT
 o TEXT_PLAIN
  public static MIMEType TEXT_PLAIN
 o APPLICATION_X_WWW_FORM_URLENCODED
  public static MIMEType APPLICATION_X_WWW_FORM_URLENCODED
 o MULTIPART_FORM_DATA
  public static MIMEType MULTIPART_FORM_DATA
 o APPLICATION_X_JAVA_AGENT
  public static MIMEType APPLICATION_X_JAVA_AGENT
 o MATCH_TYPE
  public final int MATCH_TYPE
 o MATCH_EXACT_TYPE
  public final int MATCH_EXACT_TYPE
 o MATCH_SUBTYPE
  public final int MATCH_SUBTYPE
 o MATCH_EXACT_SUBTYPE
  public final int MATCH_EXACT_SUBTYPE
 o MATCH_VERSION
  public final int MATCH_VERSION
 o MATCH_EXACT_VERSION
  public final int MATCH_EXACT_VERSION
 o MATCH_LEVEL
  public final int MATCH_LEVEL
 o MATCH_EXACT_LEVEL
  public final int MATCH_EXACT_LEVEL
 o type
  protected String type
 o subtype
  protected String subtype
 o version
  protected double version
 o level
  protected int level
 o parameters
  protected MIMETypeParameter parameters[]
 o external
  protected String external

Constructors

 o 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.

Methods

 o 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.
 o 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
 o 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.
 o 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.
 o main
  public static void main(String args[])

All Packages  Class Hierarchy  This Package  Previous  Next  Index