Package org.apache.tika.mime
Class MimeType
- java.lang.Object
- 
- org.apache.tika.mime.MimeType
 
- 
- All Implemented Interfaces:
- Serializable,- Comparable<MimeType>
 
 public final class MimeType extends Object implements Comparable<MimeType>, Serializable Internet media type.- See Also:
- Serialized Form
 
- 
- 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(MimeType mime)booleanequals(Object o)StringgetAcronym()Returns an acronym for this mime type.StringgetDescription()Returns the description of this media type.StringgetExtension()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 typeStringgetName()Returns the name of this media type.MediaTypegetType()Returns the normalized media type name.StringgetUniformTypeIdentifier()Get the UTI for this mime type.inthashCode()booleanhasMagic()static booleanisValid(String name)Checks that the given string is a valid Internet media type name based on rules from RFC 2054 section 5.3.booleanmatches(byte[] data)booleanmatchesMagic(byte[] data)voidsetDescription(String description)Set the description of this media type.StringtoString()Returns the name of this media type.
 
- 
- 
- 
Method Detail- 
isValidpublic 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. For validation purposes the rules can be simplified to the following:name := token "/" token token := 1*<any (US-ASCII) CHAR except SPACE, CTLs, or tspecials> tspecials := "(" / ")" / "<" / ">" / "@" / "," / ";" / ":" / "\" / <"> / "/" / "[" / "]" / "?" / "="- Parameters:
- name- name string
- Returns:
- trueif the string is a valid media type name,- falseotherwise
 
 - 
getTypepublic MediaType getType() Returns the normalized media type name.- Returns:
- media type
 
 - 
getNamepublic String getName() Returns the name of this media type.- Returns:
- media type name (lower case)
 
 - 
getDescriptionpublic String getDescription() Returns the description of this media type.- Returns:
- media type description
 
 - 
setDescriptionpublic void setDescription(String description) Set the description of this media type.- Parameters:
- description- media type description
 
 - 
getAcronympublic String getAcronym() Returns an acronym for this mime type.- Returns:
- mime type acronym
 
 - 
getUniformTypeIdentifierpublic String getUniformTypeIdentifier() Get the UTI for this mime type.- Returns:
- The Uniform Type Identifier
- See Also:
- http://en.wikipedia.org/wiki/Uniform_Type_Identifier
 
 - 
getLinkspublic List<URI> getLinks() Get a list of links to help document this mime type- Returns:
- an array of links (will never be null)
 
 - 
hasMagicpublic boolean hasMagic() 
 - 
matchesMagicpublic boolean matchesMagic(byte[] data) 
 - 
matchespublic boolean matches(byte[] data) 
 - 
compareTopublic int compareTo(MimeType mime) - Specified by:
- compareToin interface- Comparable<MimeType>
 
 - 
toStringpublic String toString() Returns the name of this media type.
 - 
getExtensionpublic String getExtension() Returns the preferred file extension of this type, or an empty string if no extensions are known. Use thegetExtensions()method to get the full list of known extensions of this type.- Returns:
- preferred file extension or empty string
- Since:
- Apache Tika 0.9
 
 
- 
 
-