org.apache.tika.mime
Class MediaType

java.lang.Object
  extended by org.apache.tika.mime.MediaType

public final class MediaType
extends java.lang.Object

Internet media type.


Field Summary
static MediaType APPLICATION_XML
           
static MediaType OCTET_STREAM
           
static MediaType TEXT_PLAIN
           
 
Constructor Summary
MediaType(MediaType type, java.util.Map<java.lang.String,java.lang.String> parameters)
           
MediaType(java.lang.String type, java.lang.String subtype)
           
MediaType(java.lang.String type, java.lang.String subtype, java.util.Map<java.lang.String,java.lang.String> parameters)
           
 
Method Summary
static MediaType application(java.lang.String type)
           
static MediaType audio(java.lang.String type)
           
 boolean equals(java.lang.Object object)
           
 MediaType getBaseType()
           
 java.util.Map<java.lang.String,java.lang.String> getParameters()
           
 java.lang.String getSubtype()
           
 java.lang.String getType()
           
 int hashCode()
           
static MediaType image(java.lang.String type)
           
 boolean isSpecializationOf(MediaType that)
           
static MediaType parse(java.lang.String string)
          Parses the given string to a media type.
static MediaType text(java.lang.String type)
           
 java.lang.String toString()
           
static MediaType video(java.lang.String type)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

OCTET_STREAM

public static final MediaType OCTET_STREAM

TEXT_PLAIN

public static final MediaType TEXT_PLAIN

APPLICATION_XML

public static final MediaType APPLICATION_XML
Constructor Detail

MediaType

public MediaType(java.lang.String type,
                 java.lang.String subtype,
                 java.util.Map<java.lang.String,java.lang.String> parameters)

MediaType

public MediaType(java.lang.String type,
                 java.lang.String subtype)

MediaType

public MediaType(MediaType type,
                 java.util.Map<java.lang.String,java.lang.String> parameters)
Method Detail

application

public static MediaType application(java.lang.String type)

audio

public static MediaType audio(java.lang.String type)

image

public static MediaType image(java.lang.String type)

text

public static MediaType text(java.lang.String type)

video

public static MediaType video(java.lang.String type)

parse

public static MediaType parse(java.lang.String string)
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 null if parsing fails

getBaseType

public MediaType getBaseType()

getType

public java.lang.String getType()

getSubtype

public java.lang.String getSubtype()

getParameters

public java.util.Map<java.lang.String,java.lang.String> getParameters()

isSpecializationOf

public boolean isSpecializationOf(MediaType that)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object object)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object


Copyright © 2007-2010 The Apache Software Foundation. All Rights Reserved.