public class MimeType extends Objectimplements Externalizable
| Constructor and Description |
|---|
MimeType()
Default constructor.
|
MimeType(String
Constructor that builds a MimeType from a String.
|
MimeType(String
Constructor that builds a MimeType with the given primary and sub type but has an empty parameter list.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getBaseType()
Return a String representation of this object without the parameter list.
|
String |
getParameter(String
Retrieve the value associated with the given name, or null if there is no current association.
|
MimeTypeParameterList |
getParameters()
Retrieve this object's parameter list.
|
String |
getPrimaryType()
Retrieve the primary type of this object.
|
String |
getSubType()
Retrieve the subtype of this object.
|
boolean |
match(MimeType
Determine if the primary and sub type of this object is the same as what is in the given type.
|
boolean |
match(String
Determine if the primary and sub type of this object is the same as the content type described in rawdata.
|
void |
readExternal(ObjectInput
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
Remove any value associated with the given name.
|
void |
setParameter(String
Set the value to be associated with the given name, replacing any previous association.
|
void |
setPrimaryType(String
Set the primary type for this object to the given String.
|
void |
setSubType(String
Set the subtype for this object to the given String.
|
String |
toString()
Return the String representation of this object.
|
void |
writeExternal(ObjectOutput
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.
|
public MimeType()
public MimeType(Stringrawdata) throws MimeTypeParseException
rawdata - the MIME type string
MimeTypeParseException
public MimeType(Stringprimary, String sub) throws MimeTypeParseException
primary - the primary MIME type
sub - the MIME sub-type
MimeTypeParseException - if the primary type or subtype is not a valid token
public StringgetPrimaryType()
public void setPrimaryType(Stringprimary) throws MimeTypeParseException
primary - the primary MIME type
MimeTypeParseException - if the primary type is not a valid token
public StringgetSubType()
public void setSubType(Stringsub) throws MimeTypeParseException
sub - the MIME subtype
MimeTypeParseException - if the subtype is not a valid token
public MimeTypeParameterListgetParameters()
public StringgetParameter(String name)
name - the parameter name
public void setParameter(Stringname, String value)
name - the parameter name
value - the paramter's value
public void removeParameter(Stringname)
name - the parameter name
public StringtoString()
public StringgetBaseType()
public boolean match(MimeTypetype)
type - the MimeType object to compare with
public boolean match(Stringrawdata) throws MimeTypeParseException
rawdata - the MIME type string to compare with
MimeTypeParseException
public void writeExternal(ObjectOutputout) throws IOException
writeExternal in interface
Externalizable
out - the ObjectOutput object to write to
IOException - Includes any I/O exceptions that may occur
public void readExternal(ObjectInputin) throws IOException , ClassNotFoundException
readExternal in interface
Externalizable
in - the ObjectInput object to read from
ClassNotFoundException - If the class for an object being restored cannot be found.
IOException - if I/O errors occur