    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class org.w3c.www.mime.MimeType

    java.lang.Object
       |
       +----org.w3c.www.mime.MimeType

public class MimeType
extends Object
implements Serializable

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_CSS
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.
getSubtype()
  Get the minor type (subtype) of this mime type.
getType()
  Get the major type of this mime type.
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

TEXT_CSS

     public static MimeType TEXT_CSS

MATCH_TYPE

     public static final int MATCH_TYPE

MATCH_SPECIFIC_TYPE

     public static final int MATCH_SPECIFIC_TYPE

MATCH_SUBTYPE

     public static final int MATCH_SUBTYPE

MATCH_SPECIFIC_SUBTYPE

     public static 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.

getType

     public String getType()

  Get the major type of this mime type.

  Returns:
    The major type, encoded as a String.

getSubtype

     public String getSubtype()

  Get the minor type (subtype) of this mime type.

  Returns:
    The minor or subtype encoded as a String.

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