Class java.util.mime.MimeType
java.lang.Object
|
+----java.util.mime.MimeType
- public class MimeType
- extends Object
- implements Externalizable, Cloneable
A Multipurpose Internet Mail Extension (MIME) type, as defined
in RFC 2045 and 2046.
Constructor Summary
|
MimeType(String rawdata)
Constructor that builds a MimeType from a String.
|
MimeType(String primary,
String sub)
Constructor that builds a MimeType with the given primary and sub
type
but has an empty parameter list.
|
MimeType(String primary,
String sub,
MimeTypeParameterList mtpl)
Constructor used to initialize MimeType, with a pre-defined
and valid (or empty) parameter list.
|
Method Summary
|
Object
|
clone()
|
String
|
getBaseType()
Return a String representation of this object
without the parameter list.
|
String
|
getParameter(String name)
Retrieve the value associated with the given name, or null if there
is no current association.
|
MimeTypeParameterList
|
getParameters()
Retrieve a copy of this object's parameter list.
|
String
|
getPrimaryType()
Retrieve the primary type of this object.
|
String
|
getSubType()
Retrieve the sub type of this object.
|
boolean
|
match(MimeType type)
Determine of the primary and sub type of this object is
the same as the what is in the given type.
|
boolean
|
match(String rawdata)
Determine of the primary and sub type of this object is
the same as the content type described in rawdata.
|
void
|
readExternal(ObjectInput in)
The object implements the readExternal method to restore its
contents by calling the methods of DataInput for primitive
types and readObject for objects, strings and arrays.
|
void
|
removeParameter(String name)
Remove any value associated with the given name.
|
void
|
setParameter(String name,
String value)
Set the value to be associated with the given name, replacing
any previous association.
|
String
|
toString()
Return the String representation of this object.
|
void
|
writeExternal(ObjectOutput out)
The object implements the writeExternal method to save its contents
by calling the methods of DataOutput for its primitive values or
calling the writeObject method of ObjectOutput for objects, strings
and arrays.
|
Methods inherited from class java.lang.Object
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MimeType
public MimeType(String rawdata) throws MimeTypeParseException
- Constructor that builds a MimeType from a String.
MimeType
public MimeType(String primary,
String sub) throws MimeTypeParseException
- Constructor that builds a MimeType with the given primary and sub
type
but has an empty parameter list.
MimeType
public MimeType(String primary,
String sub,
MimeTypeParameterList mtpl) throws MimeTypeParseException
- Constructor used to initialize MimeType, with a pre-defined
and valid (or empty) parameter list.
getPrimaryType
public String getPrimaryType()
- Retrieve the primary type of this object.
getSubType
public String getSubType()
- Retrieve the sub type of this object.
getParameters
public MimeTypeParameterList getParameters()
- Retrieve a copy of this object's parameter list.
getParameter
public String getParameter(String name)
- Retrieve the value associated with the given name, or null if there
is no current association.
setParameter
public void setParameter(String name,
String value)
- Set the value to be associated with the given name, replacing
any previous association.
removeParameter
public void removeParameter(String name)
- Remove any value associated with the given name.
toString
public String toString()
- Return the String representation of this object.
- Overrides:
- toString in class Object
getBaseType
public String getBaseType()
- Return a String representation of this object
without the parameter list.
match
public boolean match(MimeType type)
- Determine of the primary and sub type of this object is
the same as the what is in the given type.
match
public boolean match(String rawdata) throws MimeTypeParseException
- Determine of the primary and sub type of this object is
the same as the content type described in rawdata.
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- The object implements the writeExternal method to save its contents
by calling the methods of DataOutput for its primitive values or
calling the writeObject method of ObjectOutput for objects, strings
and arrays.
- Implements:
- writeExternal in interface Externalizable
- Throws:
- IOException - Includes any I/O exceptions that may occur
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- The object implements the readExternal method to restore its
contents by calling the methods of DataInput for primitive
types and readObject for objects, strings and arrays. The
readExternal method must read the values in the same sequence
and with the same types as were written by writeExternal.
- Implements:
- readExternal in interface Externalizable
- Throws:
- ClassNotFoundException - If the class for an object being
restored cannot be found.
clone
public Object clone() throws CloneNotSupportedException
- Returns:
- a clone of this object
- Overrides:
- clone in class Object
Submit a bug or feature
Submit comments/suggestions about new javadoc look.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.