Project JXTA

net.jxta.document
Class MimeMediaType

java.lang.Object
  |
  +--net.jxta.document.MimeMediaType

public class MimeMediaType
extends java.lang.Object

This class is a utility class with mostly provides the common parsing features needed to deal with MIME media types. FIXME bondolo@jxta.org 20010219 Doesnt yet handle parameters

Since:
JXTA 1.0
See Also:
Document, StructuredDocument, StructuredTextDocument

Constructor Summary
MimeMediaType(java.lang.String someString)
          Creates a new MimeMediaType
MimeMediaType(java.lang.String type, java.lang.String subtype)
          Creates a new type/subtype MimeMediaType
MimeMediaType(java.lang.String type, java.lang.String subtype, java.lang.String parameters)
          Creates a new type/subtype MimeMediaType
MimeMediaType(java.lang.String type, java.lang.String subtype, java.lang.String[] parameters)
          Creates a new type/subtype MimeMediaType
 
Method Summary
 void addParameter(java.lang.String newParam)
          Add parameter to a mime-type
 java.lang.Object clone()
          Creates a new object of the same class as this object.
 boolean equals(java.lang.Object obj)
          Compares two Objects for equality.
 java.lang.String getMimeMediaType()
          Get the full mime-type/subtype
 java.util.Enumeration getParameters()
          Get parameters value of a mime-type
 java.lang.String getSubtype()
          Get the Subtype of the mime-type
 java.lang.String getType()
          Get type of the mime-type
 int hashCode()
          Returns a hash code value for the object.
 boolean isExperimentalSubtype()
          Check if the mime-type is for debugging.
 boolean isExperimentalType()
          Check if the mime-type is for provisional.
 boolean isValid()
          Check if mime-type is valid
 void setParameters(java.lang.String[] parameters)
          Set parameter to a mime-type
 void setSubtype(java.lang.String subtype)
          Set the subtype of MimeMediaType
 void setType(java.lang.String type)
          Set the type of MimeMediaType
 java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MimeMediaType

public MimeMediaType(java.lang.String someString)
Creates a new MimeMediaType
Parameters:
someString - string representing a mime-type
Since:
JXTA 1.0

MimeMediaType

public MimeMediaType(java.lang.String type,
                     java.lang.String subtype)
Creates a new type/subtype MimeMediaType
Parameters:
type - string representing a mime type
subtype - string representing a mime subtype
Since:
JXTA 1.0

MimeMediaType

public MimeMediaType(java.lang.String type,
                     java.lang.String subtype,
                     java.lang.String parameters)
Creates a new type/subtype MimeMediaType
Parameters:
type - string representing a mime type
subtype - string representing a mime subtype
parameters - parameters to the mime-type constructor
Since:
JXTA 1.0

MimeMediaType

public MimeMediaType(java.lang.String type,
                     java.lang.String subtype,
                     java.lang.String[] parameters)
Creates a new type/subtype MimeMediaType
Parameters:
type - string representing a mime type
subtype - string representing a mime subtype
parameters[] - array of parameters to the mime-type constructor
Since:
JXTA 1.0
Method Detail

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Creates a new object of the same class as this object. It then initializes each of the new object's fields by assigning it the same value as the corresponding field in this object. No constructor is called.

The clone method of class Object will only clone an object whose class indicates that it is willing for its instances to be cloned. A class indicates that its instances can be cloned by declaring that it implements the Cloneable interface.

Overrides:
clone in class java.lang.Object
Returns:
Object a clone of this instance.
Throws:
java.lang.CloneNotSupportedException - if the object's class does not support the Cloneable interface. Subclasses that override the clone method can also throw this exception to indicate that an instance cannot be cloned.
Since:
JXTA 1.0

equals

public boolean equals(java.lang.Object obj)
Compares two Objects for equality.

The equals method implements an equivalence relation:

The equals method for class Object implements the most discriminating possible equivalence relation on objects; that is, for any reference values x and y, this method returns true if and only if x and y refer to the same object (x==y has the value true).

Overrides:
equals in class java.lang.Object
Parameters:
obj - the reference object with which to compare.
Returns:
boolean true if this object is the same as the obj argument; false otherwise.
Since:
JXTA 1.0

hashCode

public int hashCode()
Returns a hash code value for the object. This method is supported for the benefit of hashtables such as those provided by java.util.Hashtable.

The general contract of hashCode is:

Overrides:
hashCode in class java.lang.Object
Returns:
int a hash code value for this object.
Since:
JXTA 1.0

toString

public java.lang.String toString()
Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommendedthat all subclasses override this method.

The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object.

Overrides:
toString in class java.lang.Object
Returns:
String a string representation of the object.
Since:
JXTA 1.0

isValid

public boolean isValid()
Check if mime-type is valid
Returns:
booelan true if mime-type is well-formed
Since:
JXTA 1.0

getMimeMediaType

public java.lang.String getMimeMediaType()
Get the full mime-type/subtype
Returns:
full mime-type/subtype
Since:
JXTA 1.0

getType

public java.lang.String getType()
Get type of the mime-type
Returns:
type of the mime-type
Since:
JXTA 1.0

isExperimentalType

public boolean isExperimentalType()
Check if the mime-type is for provisional.
Returns:
boolean true if it is a provisional type
Since:
JXTA 1.0

setType

public void setType(java.lang.String type)
Set the type of MimeMediaType
Parameters:
type - type value
Since:
JXTA 1.0

getSubtype

public java.lang.String getSubtype()
Get the Subtype of the mime-type
Since:
JXTA 1.0

isExperimentalSubtype

public boolean isExperimentalSubtype()
Check if the mime-type is for debugging. This method will be removed
Returns:
boolean true if it is a debugging type
Since:
JXTA 1.0

setSubtype

public void setSubtype(java.lang.String subtype)
Set the subtype of MimeMediaType
Parameters:
subtype - subtype value
Since:
JXTA 1.0

getParameters

public java.util.Enumeration getParameters()
Get parameters value of a mime-type
Returns:
Enumeration return enumeration of parameters for this mime-type
Since:
JXTA 1.0

setParameters

public void setParameters(java.lang.String[] parameters)
Set parameter to a mime-type
Parameters:
parameters - array of parameters
Since:
JXTA 1.0

addParameter

public void addParameter(java.lang.String newParam)
Add parameter to a mime-type
Parameters:
newParam - new parameter to add to the type
Since:
JXTA 1.0

Project JXTA