Project JXTA

net.jxta.document
Class MimeMediaType

java.lang.Object
  |
  +--net.jxta.document.MimeMediaType
All Implemented Interfaces:
java.lang.Cloneable

public class MimeMediaType
extends java.lang.Object
implements java.lang.Cloneable

Mime Media Types are used to describe the format of data streams. Its format is defined by IETF RFC 2046 MIME : Media Types. This class manages parsing of Mime Media Types from strings and piecemeal construction of Mime Media Type descriptors.

Since:
JXTA 1.0
Version:
$Revision: 1.20 $
See Also:
Document, StructuredDocument, StructuredTextDocument

Constructor Summary
MimeMediaType(MimeMediaType type, java.lang.String params, boolean replace)
          Creates a new type/subtype MimeMediaType with the specified parameters.
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
 
Method Summary
 java.lang.Object clone()
          {@inheritDoc}
 boolean equals(java.lang.Object obj)
          {@inheritDoc}
 java.lang.String getMimeMediaType()
          Get the "root" mime-type/subtype without any of the parameters.
 java.lang.String getParameter(java.lang.String param)
          Get the value of the first occurance of the specified parameter from the parameter list.
 java.lang.String getSubtype()
          Get the Subtype of the mime-type
 java.lang.String getType()
          Get type of the mime-type
 int hashCode()
          {@inheritDoc}
 boolean isExperimentalSubtype()
          Check if the mime-type is for debugging.
 boolean isExperimentalType()
          Check if the mime-type is for provisional.
 java.lang.String toString()
          {@inheritDoc}
 
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(MimeMediaType type,
                     java.lang.String params,
                     boolean replace)
Creates a new type/subtype MimeMediaType with the specified parameters. The parameters are copied from the source mime type and additional params are added. If replace is true, then the provided params will overwrite the params from the source mime type.
Parameters:
type - the source mime type
params - parameters to the mime-type constructor
replace - parameters if true then provided params should replace existing params else they are accumulated.
Since:
JXTA 1.0
Method Detail

clone

public java.lang.Object clone()
{@inheritDoc}
Overrides:
clone in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
{@inheritDoc}
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
{@inheritDoc}
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
{@inheritDoc}
Overrides:
toString in class java.lang.Object

getMimeMediaType

public java.lang.String getMimeMediaType()
Get the "root" mime-type/subtype without any of the parameters.
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. See Section 2.1 of IETF RFC 2048 MIME : Registration Procedures
Returns:
boolean true if it is a provisional type
Since:
JXTA 1.0

getSubtype

public java.lang.String getSubtype()
Get the Subtype of the mime-type
Returns:
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

getParameter

public java.lang.String getParameter(java.lang.String param)
Get the value of the first occurance of the specified parameter from the parameter list.
Parameters:
param - the parameter to retrieve.
Returns:
the value of the specifid parameter or null if the parameter was not found.

Project JXTA