public class MimeType
extends java.lang.Object
implements java.io.Externalizable
| Constructor and Description |
|---|
MimeType()
Constructor for an
application/* content type. |
MimeType(java.lang.String rawdata)
Constructor that parses a raw String.
|
MimeType(java.lang.String primary,
java.lang.String sub)
Constructor for a new MIME type with the given primary and sub types
and an empty parameter list.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
checkValidity(java.lang.String token,
java.lang.String message) |
java.lang.String |
getBaseType()
Returns the string representation of this MIME type without
parameters.
|
java.lang.String |
getParameter(java.lang.String name)
Returns the parameter value for the specified name.
|
MimeTypeParameterList |
getParameters()
Returns the MIME parameters.
|
java.lang.String |
getPrimaryType()
Returns the primary type.
|
java.lang.String |
getSubType()
Returns the subtype.
|
static boolean |
isValidChar(char c) |
boolean |
match(MimeType type)
Returns true if the primary and subtype of this MIME type are the
same as in the given MIME type.
|
boolean |
match(java.lang.String rawdata)
Returns true if the primary and subtype of this MIME type are the
same as in the given MIME type string.
|
void |
readExternal(java.io.ObjectInput in) |
void |
removeParameter(java.lang.String name)
Removes the parameter value for the specified name.
|
void |
setParameter(java.lang.String name,
java.lang.String value)
Sets the parameter value for the specified name.
|
void |
setPrimaryType(java.lang.String primary)
Sets the primary type.
|
void |
setSubType(java.lang.String sub)
Sets the subtype.
|
java.lang.String |
toString()
Returns the complete string representation of this MIME type.
|
void |
writeExternal(java.io.ObjectOutput out) |
public MimeType()
application/* content type.public MimeType(java.lang.String rawdata)
throws MimeTypeParseException
rawdata - the MIME type stringMimeTypeParseExceptionpublic MimeType(java.lang.String primary,
java.lang.String sub)
throws MimeTypeParseException
primary - the primary typesub - the subtypeMimeTypeParseExceptionpublic java.lang.String getPrimaryType()
public void setPrimaryType(java.lang.String primary)
throws MimeTypeParseException
primary - the new primary typeMimeTypeParseExceptionpublic java.lang.String getSubType()
public void setSubType(java.lang.String sub)
throws MimeTypeParseException
sub - the new subtypeMimeTypeParseExceptionpublic MimeTypeParameterList getParameters()
public java.lang.String getParameter(java.lang.String name)
name - the parameter namepublic void setParameter(java.lang.String name,
java.lang.String value)
name - the parameter namevalue - the new valuepublic void removeParameter(java.lang.String name)
name - the parameter namepublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String getBaseType()
public boolean match(MimeType type)
public boolean match(java.lang.String rawdata)
throws MimeTypeParseException
MimeTypeParseExceptionpublic void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
writeExternal in interface java.io.Externalizablejava.io.IOExceptionpublic void readExternal(java.io.ObjectInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
readExternal in interface java.io.Externalizablejava.io.IOExceptionjava.lang.ClassNotFoundExceptionpublic static void checkValidity(java.lang.String token,
java.lang.String message)
throws MimeTypeParseException
MimeTypeParseExceptionpublic static boolean isValidChar(char c)