public class MimeType extends Object implements Externalizable
Constructor and Description |
---|
MimeType()
默认构造函数。
|
MimeType(String rawdata)
构造函数建立一个MimeType从一个字符串。
|
MimeType(String primary, String sub)
构造函数建立一个MimeType的主要亚型但有一个空的参数列表。
|
Modifier and Type | Method and Description |
---|---|
String |
getBaseType()
返回这个对象的字符串表示形式,而不需要参数列表。
|
String |
getParameter(String name)
检索与给定名称关联的值,或如果没有当前关联,则为空。
|
MimeTypeParameterList |
getParameters()
检索此对象的参数列表。
|
String |
getPrimaryType()
检索此对象的主要类型。
|
String |
getSubType()
检索此对象的子类型。
|
boolean |
match(MimeType type)
确定这个对象的主和子类型是否与给定类型中的相同。
|
boolean |
match(String rawdata)
确定主的子对象类型是描述数据的内容类型相同。
|
void |
readExternal(ObjectInput in)
该对象实现了readexternal方法调用的数据输入方法的基本类型和readObject对象还原其内容,字符串和数组。
|
void |
removeParameter(String name)
删除与给定名称相关联的任何值。
|
void |
setParameter(String name, String value)
将要与给定的名称关联的值,替换任何先前的关联。
|
void |
setPrimaryType(String primary)
将此对象的主要类型设置为给定的字符串。
|
void |
setSubType(String sub)
为该对象设置该对象的子类型为给定的字符串。
|
String |
toString()
返回此对象的字符串表示形式。
|
void |
writeExternal(ObjectOutput out)
该对象实现writeExternal方法通过调用数据的方法为其原始值或调用对象的objectoutput writeObject方法保存其内容,字符串和数组。
|
public MimeType()
public MimeType(String rawdata) throws MimeTypeParseException
rawdata
的MIME类型的字符串
MimeTypeParseException
public MimeType(String primary, String sub) throws MimeTypeParseException
primary
-主要类型
sub
- MIME分型
MimeTypeParseException
如果主型或亚型是不是一个有效的令牌
public String getPrimaryType()
public void setPrimaryType(String primary) throws MimeTypeParseException
primary
-主要类型
MimeTypeParseException
-如果主要类型是不是一个有效的令牌
public String getSubType()
public void setSubType(String sub) throws MimeTypeParseException
sub
的MIME类型
MimeTypeParseException
如果亚型是不是一个有效的令牌
public MimeTypeParameterList getParameters()
public String getParameter(String name)
name
-参数名称
public void setParameter(String name, String value)
name
-参数名称
value
-参数的值
public void removeParameter(String name)
name
-参数名称
public String getBaseType()
public boolean match(MimeType type)
type
- mime类型对象的比较
public boolean match(String rawdata) throws MimeTypeParseException
rawdata
的MIME类型的字符串比较
MimeTypeParseException
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
接口
Externalizable
out
- objectoutput对象写
IOException
-包括任何I/O异常可能发生
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
接口
Externalizable
in
- objectinput对象读取
ClassNotFoundException
恢复无法找到类。
IOException
如果I/O错误发生
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.