    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.

##

APPLICATION_POSTSCRIPT
APPLICATION_X_JAVA_AGENT
APPLICATION_X_WWW_FORM_URLENCODED
external
MATCH_SPECIFIC_SUBTYPE
MATCH_SPECIFIC_TYPE
MATCH_SUBTYPE
MATCH_TYPE
MESSAGE_HTTP
MULTIPART_FORM_DATA
pnames
pvalues
subtype
TEXT_HTML
  List of well known MIME types:
TEXT_PLAIN
type

##

MimeType(String)
  Construct MimeType object for the given string.
MimeType(String, String)
MimeType(String, String, String[], 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:
  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
toString()
  A printable representation of this MimeType.

##

TEXT_HTML

      public static MimeType TEXT_HTML

  List of well known MIME types:

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

MESSAGE_HTTP

      public static MimeType MESSAGE_HTTP

MATCH_TYPE

      public final int MATCH_TYPE

MATCH_SPECIFIC_TYPE

      public final int MATCH_SPECIFIC_TYPE

MATCH_SUBTYPE

      public final int MATCH_SUBTYPE

MATCH_SPECIFIC_SUBTYPE

      public final int MATCH_SPECIFIC_SUBTYPE

type

      protected String type

subtype

      protected String subtype

pnames

      protected String pnames[]

pvalues

      protected String pvalues[]

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.

MimeType

      public MimeType(String type,
                      String subtype,
                      String pnames[],
                      String pvalues[])

MimeType

      public MimeType(String type,
                      String subtype)

##

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.

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