de.grogra.util
public final class MimeType extends java.lang.Object implements java.io.Serializable
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.| Modifier and Type | Field and Description |
|---|---|
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 and Description |
|---|
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. |
| Modifier and Type | Method and Description |
|---|---|
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. |
public static final MimeType APPLICATION_XML
application/xml without parameters.public static final java.lang.String CLASS_PARAM
class of the parameter which indicates the
Java class of the MIME type JAVA_OBJECT.public static final MimeType CSV
text/x-csv without parameters.public static final MimeType GZIP
application/x-gzip without parameters.public static final MimeType INVALID
public static final MimeType JAR
application/x-jar without parameters.public static final java.lang.String JAVA_OBJECT
application/x-java-jvm-local-objectref, as string.public static final MimeType OCTET_STREAM
application/octet-stream without parameters.public static final MimeType PDF
application/pdf without parameters.public static final MimeType PNG
image/png without parameters.public static final MimeType POSTSCRIPT
application/postscript without parameters.public static final MimeType TEXT_HTML
text/html without parameters.public static final MimeType TEXT_PLAIN
text/plain without parameters.public static final MimeType TEXT_SCI
text/sci for greenscilab parameter files.public static final MimeType TEXT_XML
text/xml without parameters.public static final java.lang.String WRAPPED_TYPE_PARAM
public MimeType(java.lang.String mimeType)
mimeType and constructs a new MimeType
using the parsed information. The complete syntax of RFC 2045 is
supported.mimeType - MIME type specification according to RFC 2045public MimeType(java.lang.String mediaType,
StringMap params)
MimeType for the given parameters.mediaType - the media type (e.g., text/plain)params - the parameters of the MIME typepublic MimeType(java.lang.String mediaType,
StringMap params,
java.lang.Class cls)
MimeType for the given parameters.mediaType - the media type (e.g., text/plain)params - the parameters of the MIME typecls - the representation class of data of this MIME typepublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic java.lang.String getComment()
public java.lang.String getMediaType()
String,
e.g., text/plain. This does not contain parameters.public java.lang.String getParameter(java.lang.String name)
public StringMap getParameters()
public java.lang.String getPrimaryType()
text for the media type text/plain.public java.lang.Class getRepresentationClass()
public java.lang.String getSubType()
plain for the media type text/plain.public int hashCode()
hashCode in class java.lang.Objectpublic boolean isAssignableFrom(MimeType s)
public static boolean isAssignableFrom(java.lang.String target,
java.lang.String source)
public boolean isXMLMimeType()
public static java.lang.String quoteParameter(java.lang.String s)
public java.lang.String toString()
toString in class java.lang.Objectpublic static MimeType valueOf(java.lang.Class cls)
JAVA_OBJECT and representation class cls.cls - class of Java objectsclspublic static MimeType valueOf(java.lang.String mimeType)
mimeType and constructs a new
MimeType as in MimeType(String);
if mimeType is null,
null is returned.mimeType - MIME type specification according to RFC 2045MimeType instance or null