public final class MimeType extends Object implements Comparable<MimeType>, Serializable
MimeTypes.| Modifier and Type | Field and Description |
|---|---|
Function<MimeType,Boolean> |
eq
eq(org.opencastproject.util.MimeType) as a function. |
| Modifier and Type | Method and Description |
|---|---|
String |
asString()
Deprecated.
use
toString() instead |
int |
compareTo(MimeType m) |
boolean |
eq(MimeType other)
Two mime types are considered equal if type and subtype are equal.
|
boolean |
eq(String type,
String subtype)
Two mime types are considered equal if type and subtype are equal.
|
boolean |
equals(Object that) |
Option<String> |
getDescription()
Returns the mime type description.
|
Option<String> |
getFlavor()
Returns the flavor of this mime type.
|
Option<String> |
getFlavorDescription()
Returns the flavor description.
|
String |
getSubtype()
Returns the minor type of this mimetype.
|
Option<String> |
getSuffix()
Returns the main suffix for this mime type, that identifies files containing data of this flavor.
|
String[] |
getSuffixes()
Returns the registered suffixes for this mime type, that identify files containing data of this flavor.
|
String |
getType()
Returns the major type of this mimetype.
|
boolean |
hasFlavor(String flavor)
Returns
true if the file has the given flavor associated. |
int |
hashCode() |
boolean |
isEquivalentTo(String type,
String subtype)
Returns
true if this mime type is an equivalent for the specified type and subtype. |
static MimeType |
mimeType(String type,
String subtype) |
static MimeType |
mimeType(String type,
String subtype,
List<String> suffixes,
List<MimeType> equivalents,
Option<String> description,
Option<String> flavor,
Option<String> flavorDescription) |
static MimeType |
mimeType(String type,
String subtype,
String suffix) |
boolean |
supportsSuffix(String suffix)
Returns
true if the mimetype supports the specified suffix. |
String |
toString()
Returns the MimeType as a string of the form
type/subtype |
public final Function<MimeType,Boolean> eq
eq(org.opencastproject.util.MimeType) as a function.public static MimeType mimeType(String type, String subtype, List<String> suffixes, List<MimeType> equivalents, Option<String> description, Option<String> flavor, Option<String> flavorDescription)
public String getType()
For example, if the mimetype is ISO Motion JPEG 2000 which is represented as video/mj2, this method
will return video.
public String getSubtype()
For example, if the mimetype is ISO Motion JPEG 2000 which is represented as video/mj2, this method
will return mj2.
public Option<String> getSuffix()
For example, files with the suffix mj2 will contain data of type video/mj2.
public String[] getSuffixes()
getSuffix().
For example, files containing ISO Motion JPEG 2000 may have file suffixes mj2 and mjp2.
public boolean supportsSuffix(String suffix)
true if the mimetype supports the specified suffix.true if the suffix is supportedpublic Option<String> getDescription()
public Option<String> getFlavor()
A flavor is a hint on a specialized variant of a general mime type. For example, a dublin core file will have a
mime type of text/xml. Adding a flavor of mpeg-7 gives an additional hint on the file
contents.
public Option<String> getFlavorDescription()
public boolean hasFlavor(String flavor)
true if the file has the given flavor associated.true if the file has that flavorpublic String asString()
toString() insteadtype/subtypepublic boolean eq(MimeType other)
public boolean eq(String type, String subtype)
public boolean isEquivalentTo(String type, String subtype)
true if this mime type is an equivalent for the specified type and subtype.
For example, a gzipped file may have both of these mime types defined, application/x-compressed or
application/x-gzip.
true if this mime type is equalpublic int compareTo(MimeType m)
compareTo in interface Comparable<MimeType>Comparable.compareTo(java.lang.Object)public String toString()
type/subtypeCopyright © 2009–2020 Opencast Project. All rights reserved.