org.xcmis.spi.utils
Class MimeType

java.lang.Object
  extended by org.xcmis.spi.utils.MimeType

public class MimeType
extends Object

Version:
$Id: MimeType.java 2 2010-02-04 17:21:49Z andrew00x $
Author:
Andrey Parfonov

Constructor Summary
MimeType()
           
MimeType(String type, String subType)
          Create instance of MimeType.
MimeType(String type, String subType, Map<String,String> parameters)
           
 
Method Summary
 boolean equals(Object other)
          
static MimeType fromString(String source)
          Create instance of MimeType from the string.
 String getBaseType()
          
 String getParameter(String name)
           
 Map<String,String> getParameters()
           
 String getSubType()
           
 String getType()
           
 int hashCode()
          
 boolean match(MimeType other)
          Check is one mime-type compatible to other.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MimeType

public MimeType()

MimeType

public MimeType(String type,
                String subType)
Create instance of MimeType.

Parameters:
type - the name of type
subType - the name of sub-type

MimeType

public MimeType(String type,
                String subType,
                Map<String,String> parameters)
Method Detail

fromString

public static MimeType fromString(String source)
Create instance of MimeType from the string.

Parameters:
source - string that represents media-type in form 'type/sub-type'. If source is null or empty then it is the same as pass '*/*'. All parameters after ';' in source will be ignored.
Returns:
MimeType

equals

public boolean equals(Object other)

Overrides:
equals in class Object

getSubType

public String getSubType()
Returns:
get type

getType

public String getType()
Returns:
get sub-type

getParameters

public Map<String,String> getParameters()
Returns:
mime type parameters

getParameter

public String getParameter(String name)

hashCode

public int hashCode()

Overrides:
hashCode in class Object

match

public boolean match(MimeType other)
Check is one mime-type compatible to other. Function is not commutative. E.g. image/* compatible with image/png, image/jpeg, but image/png is not compatible with image/*.

Parameters:
other - MimeType to be checked for compatible with this.
Returns:
TRUE if MimeTypes compatible FALSE otherwise

getBaseType

public String getBaseType()


toString

public String toString()
Overrides:
toString in class Object


Copyright © 2003-2013 eXo Platform SAS. All Rights Reserved.