gate.corpora
Class MimeType

java.lang.Object
  extended by gate.corpora.MimeType

public class MimeType
extends Object

A very basic implementation for a MIME Type.


Field Summary
protected  Map<String,String> parameters
          The parameters map.
protected  String subtype
          The subtype component
protected  String type
          The type component
 
Constructor Summary
MimeType(String type, String subType)
          Constructor from type and subtype.
 
Method Summary
 void addParameter(String param, String value)
          Adds (and replaces if necessary) a parameter to this MIME type.
 boolean equals(Object other)
          Two MIME Types are equal if their types and subtypes coincide.
 String getParameterValue(String name)
          Gets the value for a particular parameter.
 String getSubtype()
          Returns the subtype component of this MIME Type.
 String getType()
          Returns the type component of this MIME Type.
 int hashCode()
          The hashcode is composed (by addition) from the hashcodes for the type and subtype.
 boolean hasParameter(String name)
          Checks to see if this MIME type has a particular parameter.
 void setSubtype(String subtype)
          Sets the subtype component of this MIME type.
 void setType(String type)
          Sets the type component of this MIME type.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

type

protected String type
The type component


subtype

protected String subtype
The subtype component


parameters

protected Map<String,String> parameters
The parameters map.

Constructor Detail

MimeType

public MimeType(String type,
                String subType)
Constructor from type and subtype.

Parameters:
type -
subType -
Method Detail

equals

public boolean equals(Object other)
Two MIME Types are equal if their types and subtypes coincide.

Overrides:
equals in class Object
Parameters:
other - the othe MIME Type to be compared with this one.
Returns:
true if the two MIME Types are the same.

hashCode

public int hashCode()
The hashcode is composed (by addition) from the hashcodes for the type and subtype.

Overrides:
hashCode in class Object
Returns:
and integer.

getType

public String getType()
Returns the type component of this MIME Type.

Returns:
a String value.

setType

public void setType(String type)
Sets the type component of this MIME type.

Parameters:
type - a String value.

getSubtype

public String getSubtype()
Returns the subtype component of this MIME Type.

Returns:
a String value.

setSubtype

public void setSubtype(String subtype)
Sets the subtype component of this MIME type.

Parameters:
subtype - a String value.

addParameter

public void addParameter(String param,
                         String value)
Adds (and replaces if necessary) a parameter to this MIME type.

Parameters:
param - the name of the parameter.
value - the value of the parameter.

getParameterValue

public String getParameterValue(String name)
Gets the value for a particular parameter.

Parameters:
name - the name of the parameter.
Returns:
a String value.

hasParameter

public boolean hasParameter(String name)
Checks to see if this MIME type has a particular parameter.

Parameters:
name - the name of the parameter.
Returns:
a boolean value.