public final class MimeType extends Object implements Comparable<MimeType>, Serializable
Modifier and Type | Method and Description |
---|---|
int |
compareTo(MimeType mime) |
boolean |
equals(Object o) |
String |
getAcronym()
Returns an acronym for this mime type.
|
String |
getDescription()
Returns the description of this media type.
|
String |
getExtension()
Returns the preferred file extension of this type, or an empty string
if no extensions are known.
|
List<String> |
getExtensions()
Returns the list of all known file extensions of this media type.
|
List<URI> |
getLinks()
Get a list of links to help document this mime type
|
String |
getName()
Returns the name of this media type.
|
MediaType |
getType()
Returns the normalized media type name.
|
String |
getUniformTypeIdentifier()
Get the UTI for this mime type.
|
int |
hashCode() |
boolean |
hasMagic() |
static boolean |
isValid(String name)
Checks that the given string is a valid Internet media type name
based on rules from RFC 2054 section 5.3.
|
boolean |
matches(byte[] data) |
boolean |
matchesMagic(byte[] data) |
void |
setDescription(String description)
Set the description of this media type.
|
String |
toString()
Returns the name of this media type.
|
public static boolean isValid(String name)
name := token "/" token token := 1*<any (US-ASCII) CHAR except SPACE, CTLs, or tspecials> tspecials := "(" / ")" / "<" / ">" / "@" / "," / ";" / ":" / "\" / <"> / "/" / "[" / "]" / "?" / "="
name
- name stringtrue
if the string is a valid media type name,
false
otherwisepublic MediaType getType()
public String getName()
public String getDescription()
public void setDescription(String description)
description
- media type descriptionpublic String getAcronym()
public String getUniformTypeIdentifier()
public List<URI> getLinks()
public boolean hasMagic()
public boolean matchesMagic(byte[] data)
public boolean matches(byte[] data)
public int compareTo(MimeType mime)
compareTo
in interface Comparable<MimeType>
public String toString()
public String getExtension()
getExtensions()
method to
get the full list of known extensions of this type.Copyright © 2007-2015 The Apache Software Foundation. All Rights Reserved.