Overview | Package | Class | Tree | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## de.grogra.util
Class MimeType

    java.lang.Object
      de.grogra.util.MimeType

All Implemented Interfaces:
  java.io.Serializable

    public final class MimeType

extends java.lang.Object
implements java.io.Serializable

This class implements a MIME type as specified by RFC 2045 and 2046. A MIME type consists of the specification of a top-level media type and a subtype, e.g., `text/plain`, and a (possibly empty) set of parameters. In the string representation of a MIME type, parameters are specified as the parameter `charset` in `text/plain; charset=iso-8859-1`.

Author:
  Ole Kniemeyer
See Also:
  Serialized Form

Field Summary
`static MimeType` | `APPLICATION_XML` The MIME type `application/xml` without parameters.
`static java.lang.String` | `CLASS_PARAM` The name `class` of the parameter which indicates the Java class of the MIME type `JAVA_OBJECT`.
`static MimeType` | `CSV` The MIME type `text/x-csv` without parameters.
`static MimeType` | `GZIP` The MIME type `application/x-gzip` without parameters.
`static MimeType` | `INVALID`
`static MimeType` | `JAR` The MIME type `application/x-jar` without parameters.
`static java.lang.String` | `JAVA_OBJECT` The MIME type of local Java objects, `application/x-java-jvm-local-objectref`, as string.
`static MimeType` | `OCTET_STREAM` The MIME type `application/octet-stream` without parameters.
`static MimeType` | `PDF` The MIME type `application/pdf` without parameters.
`static MimeType` | `PNG` The MIME type `image/png` without parameters.
`static MimeType` | `POSTSCRIPT` The MIME type `application/postscript` without parameters.
`static MimeType` | `TEXT_HTML` The MIME type `text/html` without parameters.
`static MimeType` | `TEXT_PLAIN` The MIME type `text/plain` without parameters.
`static MimeType` | `TEXT_SCI` The MIME type `text/sci` for greenscilab parameter files.
`static MimeType` | `TEXT_XML` The MIME type `text/xml` without parameters.
`static java.lang.String` | `WRAPPED_TYPE_PARAM`

Constructor Summary
`MimeType(java.lang.String mimeType)` Parses `mimeType` and constructs a new `MimeType` using the parsed information.
`MimeType(java.lang.String mediaType, StringMap params)` Constructs a new `MimeType` for the given parameters.
`MimeType(java.lang.String mediaType, StringMap params, java.lang.Class cls)` Constructs a new `MimeType` for the given parameters.

Method Summary
`boolean` | `equals(java.lang.Object o)`
`java.lang.String` | `getComment()` Returns the comment which has been parsed from the MIME type specification.
`java.lang.String` | `getMediaType()` Returns the media type of this MIME type as `String`, e.g., `text/plain`.
`java.lang.String` | `getParameter(java.lang.String name)`
`StringMap` | `getParameters()`
`java.lang.String` | `getPrimaryType()` Returns the primary type of this MIME type, e.g., `text` for the media type `text/plain`.
`java.lang.Class` | `getRepresentationClass()`
`java.lang.String` | `getSubType()` Returns the subtype of this MIME type, e.g., `plain` for the media type `text/plain`.
`int` | `hashCode()`
`boolean` | `isAssignableFrom(MimeType s)`
`static boolean` | `isAssignableFrom(java.lang.String target, java.lang.String source)`
`boolean` | `isXMLMimeType()`
`static java.lang.String` | `quoteParameter(java.lang.String s)`
`java.lang.String` | `toString()`
`static MimeType` | `valueOf(java.lang.Class cls)` Returns a MIME type of media type `JAVA_OBJECT` and representation class `cls`.
`static MimeType` | `valueOf(java.lang.String mimeType)` Parses `mimeType` and constructs a new `MimeType` as in `MimeType(String)`; if `mimeType` is `null`, `null` is returned.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### APPLICATION_XML

    public static final MimeType APPLICATION_XML

  The MIME type `application/xml` without parameters.

### CLASS_PARAM

    public static final java.lang.String CLASS_PARAM

  The name `class` of the parameter which indicates the Java class of the MIME type `JAVA_OBJECT`.

  See Also:
    Constant Field Values

### CSV

    public static final MimeType CSV

  The MIME type `text/x-csv` without parameters.

### GZIP

    public static final MimeType GZIP

  The MIME type `application/x-gzip` without parameters.

### INVALID

    public static final MimeType INVALID

### JAR

    public static final MimeType JAR

  The MIME type `application/x-jar` without parameters.

### JAVA_OBJECT

    public static final java.lang.String JAVA_OBJECT

  The MIME type of local Java objects, `application/x-java-jvm-local-objectref`, as string.

  See Also:
    Constant Field Values

### OCTET_STREAM

    public static final MimeType OCTET_STREAM

  The MIME type `application/octet-stream` without parameters.

### PDF

    public static final MimeType PDF

  The MIME type `application/pdf` without parameters.

### PNG

    public static final MimeType PNG

  The MIME type `image/png` without parameters.

### POSTSCRIPT

    public static final MimeType POSTSCRIPT

  The MIME type `application/postscript` without parameters.

### TEXT_HTML

    public static final MimeType TEXT_HTML

  The MIME type `text/html` without parameters.

### TEXT_PLAIN

    public static final MimeType TEXT_PLAIN

  The MIME type `text/plain` without parameters.

### TEXT_SCI

    public static final MimeType TEXT_SCI

  The MIME type `text/sci` for greenscilab parameter files.

### TEXT_XML

    public static final MimeType TEXT_XML

  The MIME type `text/xml` without parameters.

### WRAPPED_TYPE_PARAM

    public static final java.lang.String WRAPPED_TYPE_PARAM

See Also:
  Constant Field Values

Constructor Detail

### MimeType

    public MimeType(java.lang.String mimeType)

  Parses `mimeType` and constructs a new `MimeType` using the parsed information. The complete syntax of RFC 2045 is supported.

  Parameters:
    `mimeType` - MIME type specification according to RFC 2045

### MimeType

    public MimeType(java.lang.String mediaType,
                    StringMap params)

  Constructs a new `MimeType` for the given parameters.

  Parameters:
    `mediaType` - the media type (e.g., `text/plain`)
    `params` - the parameters of the MIME type

### MimeType

    public MimeType(java.lang.String mediaType,
                    StringMap params,
                    java.lang.Class cls)

  Constructs a new `MimeType` for the given parameters.

  Parameters:
    `mediaType` - the media type (e.g., `text/plain`)
    `params` - the parameters of the MIME type
    `cls` - the representation class of data of this MIME type

Method Detail

### equals

    public boolean equals(java.lang.Object o)

  Overrides:
    `equals` in class `java.lang.Object`

### getComment

    public java.lang.String getComment()

  Returns the comment which has been parsed from the MIME type specification.

  Returns:
    MIME type comment

### getMediaType

    public java.lang.String getMediaType()

  Returns the media type of this MIME type as `String`, e.g., `text/plain`. This does not contain parameters.

  Returns:
    media type of this MIME type

### getParameter

    public java.lang.String getParameter(java.lang.String name)

### getParameters

    public StringMap getParameters()

### getPrimaryType

    public java.lang.String getPrimaryType()

  Returns the primary type of this MIME type, e.g., `text` for the media type `text/plain`.

  Returns:
    primary type of this MIME type

### getRepresentationClass

    public java.lang.Class getRepresentationClass()

### getSubType

    public java.lang.String getSubType()

  Returns the subtype of this MIME type, e.g., `plain` for the media type `text/plain`.

  Returns:
    subtype of this MIME type

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `java.lang.Object`

### isAssignableFrom

    public boolean isAssignableFrom(MimeType s)

### isAssignableFrom

    public static boolean isAssignableFrom(java.lang.String target,
                                           java.lang.String source)

### isXMLMimeType

    public boolean isXMLMimeType()

### quoteParameter

    public static java.lang.String quoteParameter(java.lang.String s)

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

### valueOf

    public static MimeType valueOf(java.lang.Class cls)

  Returns a MIME type of media type `JAVA_OBJECT` and representation class `cls`.

  Parameters:
    `cls` - class of Java objects
  Returns:
    MIME type corresponding to local Java objects of class `cls`

### valueOf

    public static MimeType valueOf(java.lang.String mimeType)

  Parses `mimeType` and constructs a new `MimeType` as in `MimeType(String)`; if `mimeType` is `null`, `null` is returned.

  Parameters:
    `mimeType` - MIME type specification according to RFC 2045
  Returns:
    `MimeType` instance or `null`

Overview | Package | Class | Tree | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD