Class w3c.www.mime.MimeType
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class w3c.www.mime.MimeType

java.lang.Object
   |
   +----w3c.www.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 MATCH_SPECIFIC_SUBTYPE
 o MATCH_SPECIFIC_TYPE
 o MATCH_SUBTYPE
 o MATCH_TYPE
 o MESSAGE_HTTP
 o MULTIPART_FORM_DATA
 o pnames
 o pvalues
 o subtype
 o TEXT_CSS
 o TEXT_HTML
List of well known MIME types:
 o TEXT_PLAIN
 o type

Constructor Index

 o MimeType(String)
Construct MimeType object for the given string.
 o MimeType(String, String)
 o MimeType(String, String, String[], String[])

Method Index

 o getParameterValue(String)
Get a mime type parameter value.
 o getSubtype()
Get the minor type (subtype) of this mime type.
 o getType()
Get the major type of this mime type.
 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:
MATCH_TYPE
Types match,
MATCH_SPECIFIC_TYPE
Types match exactly,
MATCH_SUBTYPE
Types match, subtypes matches too
MATCH_SPECIFIC_SUBTYPE
Types match, subtypes matches exactly
 o toString()
A printable representation of this MimeType.

Variables

 o TEXT_HTML
  public static MimeType TEXT_HTML
List of well known MIME types:
 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 MESSAGE_HTTP
  public static MimeType MESSAGE_HTTP
 o TEXT_CSS
  public static MimeType TEXT_CSS
 o MATCH_TYPE
  public final int MATCH_TYPE
 o MATCH_SPECIFIC_TYPE
  public final int MATCH_SPECIFIC_TYPE
 o MATCH_SUBTYPE
  public final int MATCH_SUBTYPE
 o MATCH_SPECIFIC_SUBTYPE
  public final int MATCH_SPECIFIC_SUBTYPE
 o type
  protected String type
 o subtype
  protected String subtype
 o pnames
  protected String pnames[]
 o pvalues
  protected String pvalues[]
 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.
 o MimeType
  public MimeType(String type,
                  String subtype,
                  String pnames[],
                  String pvalues[])
 o MimeType
  public MimeType(String type,
                  String subtype)

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:
MATCH_TYPE
Types match,
MATCH_SPECIFIC_TYPE
Types match exactly,
MATCH_SUBTYPE
Types match, subtypes matches too
MATCH_SPECIFIC_SUBTYPE
Types match, subtypes matches exactly
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 getType
  public String getType()
Get the major type of this mime type.
Returns:
The major type, encoded as a String.
 o getSubtype
  public String getSubtype()
Get the minor type (subtype) of this mime type.
Returns:
The minor or subtype encoded as a String.
 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