public class MIMEType extends Object
This class is similar to e.g. java.awt.datatransfer.MimeType and
org.apache.pivot.util.MIMEType. We reinvent the wheel here since
there is no public MIME type class in core Java excluding AWT, which we could
use cross-environment in e.g. Android.
| Constructor and Description |
|---|
MIMEType(String mimeType)
Constructs a new MIME type object from the given MIME type string.
|
MIMEType(String mimeType,
Class<?> javaType)
Constructs a new MIME type object from the given MIME type string.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o) |
String |
getBase()
Gets the MIME type with no parameter list.
|
String |
getParameter(String name)
Gets the value of the parameter with the given name, or null if none.
|
List<String> |
getParameters()
Gets the parameter names associated with this MIME type.
|
int |
hashCode() |
boolean |
isCompatible(Class<?> javaType)
Gets whether this MIME type represents objects of the given Java class.
|
boolean |
isCompatible(MIMEType mimeType)
Gets whether this MIME type is compatible with the given one.
|
String |
toString() |
public MIMEType(String mimeType)
mimeType - The MIME type string, which may optionally include a list
of semicolon-separated parameters.public MIMEType(String mimeType, Class<?> javaType)
mimeType - The MIME type string, which may optionally include a list
of semicolon-separated parameters.javaType - The associated Java class of the MIME type. If non-null, a
"class" parameter is guaranteed to exist with the MIME type
indicating compatibility with the given Java class.IllegalArgumentException - if the mimeType includes a
different Java class parameter than the javaType.public String getBase()
public String getParameter(String name)
public List<String> getParameters()
public boolean isCompatible(MIMEType mimeType)
public boolean isCompatible(Class<?> javaType)
Copyright © 2015–2022 SciJava. All rights reserved.