| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecteu.medsea.mimeutil.MimeType
public class MimeType
This class represents a simple MimeType object. A mime type is made up of
 two parts <media type>/<sub type>.
 The media type can be something like application or text and
 the the sub type can be something like xml or plain.
 Both the media type and sub type can also be the wild card * such as
 */* and text/*. Note, if the media type is the wild card
 then the sub type must also be a wild card.
| Field Summary | |
|---|---|
| protected  String | mediaType | 
| protected  String | subType | 
| Constructor Summary | |
|---|---|
| MimeType(MimeType mimeType)Construct a MimeType from another MimeType instance | |
| MimeType(String mimeType)Construct a mime type from a String such as text/plain. | |
| Method Summary | |
|---|---|
|  int | compareTo(Object arg0)Allows us to use MimeType(s) in Sortable Set's such as the TreeSet. | 
|  boolean | equals(Object o)Overrides the equals method of java.lang.Object. | 
|  String | getMediaType()Get the media type part of the mime type. | 
|  int | getSpecificity()This indicates how specific the mime types is i.e. | 
|  String | getSubType()Get the sub type of the mime type | 
|  int | hashCode()Get the hashCode of this MimeType. | 
|  String | toString()Overrides the toString method of java.lang.Object. | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, finalize, getClass, notify, notifyAll, wait, wait, wait | 
| Field Detail | 
|---|
protected String mediaType
protected String subType
| Constructor Detail | 
|---|
public MimeType(MimeType mimeType)
mimeType - 
public MimeType(String mimeType)
         throws MimeException
text/plain.
 It tries to ensure that the mime type pattern passed in is correctly
 formatted.
mimeType - 
MimeException| Method Detail | 
|---|
public String getMediaType()
public String getSubType()
public int hashCode()
hashCode in class ObjectObject.hashCode()public boolean equals(Object o)
java.lang.Object. This is able to compare
 against another MimeType instance or a string representation of a mime type.
equals in class ObjectObject.equals(Object o)public String toString()
java.lang.Object.
toString in class Object<media type>/<sub type>.- See Also:
- Object.toString()
public int getSpecificity()
This is calculated by the number of times this MimeType would be returned if the Collection was not normalised. The higher the count the more MimeDetectors have matched this type. As this can be a false positive for types such as application/octect-stream and text/plain where they would be returned by multiple MimeDetector(s). These types are referred to as root mime types where ALL mime types derive from application/octet-stream and all text/* types derive from text/plan so in these cases we set the specificity to 0 no matter how many times they match. This ensures they are regarded as the least specific in the returned Collection.
public int compareTo(Object arg0)
compareTo in interface Comparable| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||