java.lang.Object
de.grogra.util.MimeType
- All Implemented Interfaces:
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:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final MimeType
The MIME typeapplication/xml
without parameters.static final String
The nameclass
of the parameter which indicates the Java class of the MIME typeJAVA_OBJECT
.static final MimeType
The MIME typetext/x-csv
without parameters.static final MimeType
The MIME typeapplication/x-gzip
without parameters.static final MimeType
static final MimeType
The MIME typeapplication/x-jar
without parameters.static final String
The MIME type of local Java objects,application/x-java-jvm-local-objectref
, as string.static final MimeType
The MIME typeapplication/octet-stream
without parameters.static final MimeType
The MIME typeapplication/pdf
without parameters.static final MimeType
The MIME typeimage/png
without parameters.static final MimeType
The MIME typeapplication/postscript
without parameters.static final MimeType
The MIME typetext/html
without parameters.static final MimeType
The MIME typetext/plain
without parameters.static final MimeType
The MIME typetext/sci
for greenscilab parameter files.static final MimeType
The MIME typetext/xml
without parameters.static final String
-
Constructor Summary
ConstructorDescriptionParsesmimeType
and constructs a newMimeType
using the parsed information.Constructs a newMimeType
for the given parameters.Constructs a newMimeType
for the given parameters. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns the comment which has been parsed from the MIME type specification.Returns the media type of this MIME type asString
, e.g.,text/plain
.getParameter
(String name) Returns the primary type of this MIME type, e.g.,text
for the media typetext/plain
.Returns the subtype of this MIME type, e.g.,plain
for the media typetext/plain
.int
hashCode()
boolean
static boolean
isAssignableFrom
(String target, String source) boolean
static String
toString()
static MimeType
Returns a MIME type of media typeJAVA_OBJECT
and representation classcls
.static MimeType
ParsesmimeType
and constructs a newMimeType
as inMimeType(String)
; ifmimeType
isnull
,null
is returned.
-
Field Details
-
INVALID
-
TEXT_PLAIN
The MIME typetext/plain
without parameters. -
TEXT_XML
The MIME typetext/xml
without parameters. -
TEXT_HTML
The MIME typetext/html
without parameters. -
APPLICATION_XML
The MIME typeapplication/xml
without parameters. -
OCTET_STREAM
The MIME typeapplication/octet-stream
without parameters. -
GZIP
The MIME typeapplication/x-gzip
without parameters. -
JAR
The MIME typeapplication/x-jar
without parameters. -
CSV
The MIME typetext/x-csv
without parameters. -
PDF
The MIME typeapplication/pdf
without parameters. -
POSTSCRIPT
The MIME typeapplication/postscript
without parameters. -
PNG
The MIME typeimage/png
without parameters. -
TEXT_SCI
The MIME typetext/sci
for greenscilab parameter files. -
WRAPPED_TYPE_PARAM
- See Also:
-
CLASS_PARAM
The nameclass
of the parameter which indicates the Java class of the MIME typeJAVA_OBJECT
.- See Also:
-
JAVA_OBJECT
The MIME type of local Java objects,application/x-java-jvm-local-objectref
, as string.- See Also:
-
-
Constructor Details
-
MimeType
Constructs a newMimeType
for the given parameters.- Parameters:
mediaType
- the media type (e.g.,text/plain
)params
- the parameters of the MIME typecls
- the representation class of data of this MIME type
-
MimeType
Constructs a newMimeType
for the given parameters.- Parameters:
mediaType
- the media type (e.g.,text/plain
)params
- the parameters of the MIME type
-
MimeType
ParsesmimeType
and constructs a newMimeType
using the parsed information. The complete syntax of RFC 2045 is supported.- Parameters:
mimeType
- MIME type specification according to RFC 2045
-
-
Method Details
-
valueOf
Returns a MIME type of media typeJAVA_OBJECT
and representation classcls
.- Parameters:
cls
- class of Java objects- Returns:
- MIME type corresponding to local Java objects
of class
cls
-
valueOf
ParsesmimeType
and constructs a newMimeType
as inMimeType(String)
; ifmimeType
isnull
,null
is returned.- Parameters:
mimeType
- MIME type specification according to RFC 2045- Returns:
MimeType
instance ornull
-
getMediaType
Returns the media type of this MIME type asString
, e.g.,text/plain
. This does not contain parameters.- Returns:
- media type of this MIME type
-
getPrimaryType
Returns the primary type of this MIME type, e.g.,text
for the media typetext/plain
.- Returns:
- primary type of this MIME type
-
getSubType
Returns the subtype of this MIME type, e.g.,plain
for the media typetext/plain
.- Returns:
- subtype of this MIME type
-
getComment
Returns the comment which has been parsed from the MIME type specification.- Returns:
- MIME type comment
-
getParameter
-
getParameters
-
getRepresentationClass
-
isXMLMimeType
public boolean isXMLMimeType() -
isAssignableFrom
-
isAssignableFrom
-
equals
-
hashCode
public int hashCode() -
toString
-
quoteParameter
-