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 |
---|---|
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.
|
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 stringMimeTypeParseException
public MimeType(java.lang.String primary, java.lang.String sub) throws MimeTypeParseException
primary
- the primary typesub
- the subtypeMimeTypeParseException
public java.lang.String getPrimaryType()
public void setPrimaryType(java.lang.String primary) throws MimeTypeParseException
primary
- the new primary typeMimeTypeParseException
public java.lang.String getSubType()
public void setSubType(java.lang.String sub) throws MimeTypeParseException
sub
- the new subtypeMimeTypeParseException
public 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.Object
public java.lang.String getBaseType()
public boolean match(MimeType type)
public boolean match(java.lang.String rawdata) throws MimeTypeParseException
MimeTypeParseException
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
java.io.IOException
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
java.io.IOException
java.lang.ClassNotFoundException