Class MediaType
java.lang.Object
org.apache.tika.mime.MediaType
- All Implemented Interfaces:
Serializable, Comparable<MediaType>
Internet media type.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a media type by adding a parameter to a base type.Creates a media type by adding the "charset" parameter to a base type. -
Method Summary
Modifier and TypeMethodDescriptionstatic MediaTypeapplication(String type) static MediaTypeintbooleanReturns the base form of the MediaType, excluding any parameters, such as "text/plain" for "text/plain; charset=utf-8"Returns an immutable sorted map of the parameters of this media type.Return the Sub-Type of the MediaType, such as "plain" for "text/plain"getType()Return the Type of the MediaType, such as "text" for "text/plain"inthashCode()booleanChecks whether this media type contains parameters.static MediaTypestatic MediaTypeParses the given string to a media type.Convenience method that parses the given media type strings and returns an unmodifiable set that contains all the parsed types.Convenience method that returns an unmodifiable set that contains all the given media types.static MediaTypetoString()static MediaType
-
Field Details
-
OCTET_STREAM
-
EMPTY
-
TEXT_PLAIN
-
TEXT_HTML
-
APPLICATION_XML
-
APPLICATION_ZIP
-
-
Constructor Details
-
MediaType
-
MediaType
-
MediaType
-
MediaType
-
MediaType
-
-
Method Details
-
application
-
audio
-
image
-
text
-
video
-
set
-
set
-
parse
Parses the given string to a media type. The string is expected to be of the form "type/subtype(; parameter=...)*" as defined in RFC 2045, though we also handle "charset=xxx; type/subtype" for broken web servers.- Parameters:
string- media type string to be parsed- Returns:
- parsed media type, or
nullif parsing fails
-
getBaseType
Returns the base form of the MediaType, excluding any parameters, such as "text/plain" for "text/plain; charset=utf-8" -
getType
Return the Type of the MediaType, such as "text" for "text/plain" -
getSubtype
Return the Sub-Type of the MediaType, such as "plain" for "text/plain" -
hasParameters
public boolean hasParameters()Checks whether this media type contains parameters.- Returns:
trueif this type has one or more parameters,falseotherwise- Since:
- Apache Tika 0.8
-
getParameters
-
toString
-
equals
-
hashCode
-
compareTo
- Specified by:
compareToin interfaceComparable<MediaType>
-