|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
javax.activation Class ActivationDataFlavor
java.lang.Objectjava.awt.datatransfer.DataFlavor
javax.activation.ActivationDataFlavor
- All Implemented Interfaces:
- Externalizable, Serializable, Cloneable
public class ActivationDataFlavor
- extends DataFlavor
ActivationDataFlavor 类是
java.awt.datatransfer.DataFlavor
的一个特殊子类。它允许 JAF 通过新的构造方法设置 DataFlavor 类所存储的所有三个值。它还包含 equals
方法中增强的 MIME 解析。除了增强的解析外,其语义与 JDK DataFlavor 类的语义相同。
The ActivationDataFlavor class is a special subclass of
java.awt.datatransfer.DataFlavor
. It allows the JAF to
set all three values stored by the DataFlavor class via a new
constructor. It also contains improved MIME parsing in the equals
method. Except for the improved parsing, its semantics are
identical to that of the JDK's DataFlavor class.
- See Also:
- Serialized Form
Field Summary |
---|
Fields inherited from class java.awt.datatransfer.DataFlavor |
---|
imageFlavor, javaFileListFlavor, javaJVMLocalObjectMimeType, javaRemoteObjectMimeType, javaSerializedObjectMimeType, plainTextFlavor, stringFlavor |
Constructor Summary | |
---|---|
ActivationDataFlavor(Class representationClass,
String humanPresentableName)
Construct a DataFlavor that represents a MimeType. |
|
ActivationDataFlavor(Class representationClass,
String mimeType,
String humanPresentableName)
Construct a DataFlavor that represents an arbitrary Java object. |
|
ActivationDataFlavor(String mimeType,
String humanPresentableName)
Construct a DataFlavor that represents a MimeType. |
Method Summary | |
---|---|
boolean |
equals(DataFlavor dataFlavor)
Compares the DataFlavor passed in with this DataFlavor; calls the isMimeTypeEqual method. |
String |
getHumanPresentableName()
Return the Human Presentable name. |
String |
getMimeType()
Return the MIME type for this DataFlavor. |
Class |
getRepresentationClass()
Return the representation class. |
boolean |
isMimeTypeEqual(String mimeType)
Is the string representation of the MIME type passed in equivalent to the MIME type of this DataFlavor. |
protected String |
normalizeMimeType(String mimeType)
Deprecated. |
protected String |
normalizeMimeTypeParameter(String parameterName,
String parameterValue)
Deprecated. |
void |
setHumanPresentableName(String humanPresentableName)
Set the human presentable name. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public
ActivationDataFlavor(Class<T> representationClass, String mimeType, String humanPresentableName)
构造一个表示任意 Java 对象的 DataFlavor
。此构造方法是 JDK DataFlavor 的扩展,它允许显示设置所有三个 DataFlavor 属性。
返回的 DataFlavor 将具有以下特征:
representationClass = representationClass
mimeType = mimeType
humanName = humanName
representationClass | 此 DataFlavor 中使用的类 |
mimeType | 此类表示的数据 MIME 类型 |
humanPresentableName | flavor 的得体的名称 |
ActivationDataFlavor
public ActivationDataFlavor(Class representationClass, String mimeType, String humanPresentableName)
- Construct a DataFlavor that represents an arbitrary
Java object. This constructor is an extension of the
JDK's DataFlavor in that it allows the explicit setting
of all three DataFlavor attributes.
The returned DataFlavor will have the following characteristics:
representationClass = representationClass
mimeType = mimeType
humanName = humanName- Parameters:
representationClass
- the class used in this DataFlavormimeType
- the MIME type of the data represented by this classhumanPresentableName
- the human presentable name of the flavor
public
ActivationDataFlavor(Class<T> representationClass, String humanPresentableName)
构造一个表示 MimeType
的 DataFlavor
。
返回的 DataFlavor 将具有以下特征:
如果 mimeType 为 "application/x-java-serialized-object; class=",则结果与调用新的 DataFlavor(Class:forName()) 相同(同上)。
否则:
representationClass = InputStream
mimeType = mimeType
representationClass | 此 DataFlavor 中使用的类 |
humanPresentableName | flavor 的得体的名称 |
ActivationDataFlavor
public ActivationDataFlavor(Class representationClass, String humanPresentableName)
- Construct a DataFlavor that represents a MimeType.
The returned DataFlavor will have the following characteristics:
If the mimeType is "application/x-java-serialized-object; class=", the result is the same as calling new DataFlavor(Class.forName()) as above.
otherwise:
representationClass = InputStream
mimeType = mimeType
- Parameters:
representationClass
- the class used in this DataFlavorhumanPresentableName
- the human presentable name of the flavor
public
ActivationDataFlavor(String mimeType, String humanPresentableName)
构造一个表示 MimeType 的 DataFlavor。
返回的 DataFlavor 将具有以下特征:
如果 mimeType 为 "application/x-java-serialized-object; class=",则结果与调用新的 DataFlavor(Class:forName()) 相同(同上),否则:
representationClass = InputStream
mimeType = mimeType
mimeType | 此类表示的数据 MIME 类型 |
humanPresentableName | flavor 的得体的名称 |
ActivationDataFlavor
public ActivationDataFlavor(String mimeType, String humanPresentableName)
- Construct a DataFlavor that represents a MimeType.
The returned DataFlavor will have the following characteristics:
If the mimeType is "application/x-java-serialized-object; class=", the result is the same as calling new DataFlavor(Class.forName()) as above, otherwise:
representationClass = InputStream
mimeType = mimeType
- Parameters:
mimeType
- the MIME type of the data represented by this classhumanPresentableName
- the human presentable name of the flavor
Method Detail |
---|
public String
getMimeType()
返回此 DataFlavor 的 MIME 类型。
return | MIME 类型 |
getMimeType
public String getMimeType()
- Return the MIME type for this DataFlavor.
- Overrides:
getMimeType
in classDataFlavor
- Returns:
- the MIME type
public Class<T>
getRepresentationClass()
返回表示形式类。
return | 表示形式类 |
getRepresentationClass
public Class getRepresentationClass()
- Return the representation class.
- Overrides:
getRepresentationClass
in classDataFlavor
- Returns:
- the representation class
public String
getHumanPresentableName()
返回得体的名称。
return | 得体的名称 |
getHumanPresentableName
public String getHumanPresentableName()
- Return the Human Presentable name.
- Overrides:
getHumanPresentableName
in classDataFlavor
- Returns:
- the human presentable name
public void
setHumanPresentableName(String humanPresentableName)
设置得体的名称。
humanPresentableName | 要设置的名称。 |
setHumanPresentableName
public void setHumanPresentableName(String humanPresentableName)
- Set the human presentable name.
- Overrides:
setHumanPresentableName
in classDataFlavor
- Parameters:
humanPresentableName
- the name to set
public boolean
equals(java.awt.datatransfer.DataFlavor dataFlavor)
将传入的 DataFlavor 与此 DataFlavor 进行比较;调用 isMimeTypeEqual
方法。
dataFlavor | 要与之比较的 DataFlavor |
return | 如果 MIME 类型和表示形式类都相同,则返回 true |
equals
public boolean equals(DataFlavor dataFlavor)
- Compares the DataFlavor passed in with this DataFlavor; calls
the
isMimeTypeEqual
method. - Overrides:
equals
in classDataFlavor
- Parameters:
dataFlavor
- the DataFlavor to compare with- Returns:
- true if the MIME type and representation class are the same
public boolean
isMimeTypeEqual(String mimeType)
传入的 MIME 类型的字符串表示形式是否等效于此 DataFlavor 的 MIME 类型。
ActivationDataFlavor 将 MIME 类型的比较委托给作为 JavaBeans Activation Framework 的一部分包含的 MimeType 类。相比 DataFlavor 类中通常可用的比较,此方法提供的比较更加健壮。
mimeType | MIME 类型 |
return | 如果 MIME 类型相同,则返回 true |
isMimeTypeEqual
public boolean isMimeTypeEqual(String mimeType)
- Is the string representation of the MIME type passed in equivalent
to the MIME type of this DataFlavor.
ActivationDataFlavor delegates the comparison of MIME types to the MimeType class included as part of the JavaBeans Activation Framework. This provides a more robust comparison than is normally available in the DataFlavor class.
- Overrides:
isMimeTypeEqual
in classDataFlavor
- Parameters:
mimeType
- the MIME type- Returns:
- true if the same MIME type
protected String
normalizeMimeTypeParameter(String parameterName, String parameterValue)
针对每个 MIME 类型参数对 DataFlavor 调用此方法,以允许 DataFlavor 子类处理特定参数,如文本/纯文本 charset 参数,其值是不区分大小写的。(MIME 类型参数值应该区分大小写)。
为每个参数名/值对调用此方法,应该返回 parameterValue 的标准化表示形式。此实现不再调用此方法。
parameterName | 参数名 |
parameterValue | 参数值 |
return | 标准化的参数值 |
deprecated |
normalizeMimeTypeParameter
protected String normalizeMimeTypeParameter(String parameterName, String parameterValue)
- Deprecated.
- Called on DataFlavor for every MIME Type parameter to allow DataFlavor
subclasses to handle special parameters like the text/plain charset
parameters, whose values are case insensitive. (MIME type parameter
values are supposed to be case sensitive).
This method is called for each parameter name/value pair and should return the normalized representation of the parameterValue. This method is never invoked by this implementation.
- Overrides:
normalizeMimeTypeParameter
in classDataFlavor
- Parameters:
parameterName
- the parameter nameparameterValue
- the parameter value- Returns:
- the normalized parameter value
protected String
normalizeMimeType(String mimeType)
为每个 MIME 类型字符串调用此方法,以使 DataFlavor 子类型能够更改实现 MIME 类型标准化的方式。一种可能的用法是,在传入的 MIME 类型字符串中不存在参数/值对的情况下添加默认的参数/值对。此实现不再调用此方法。
mimeType | MIME 类型 |
return | 标准化的 MIME 类型 |
deprecated |
normalizeMimeType
protected String normalizeMimeType(String mimeType)
- Deprecated.
- Called for each MIME type string to give DataFlavor subtypes the
opportunity to change how the normalization of MIME types is
accomplished.
One possible use would be to add default parameter/value pairs in cases
where none are present in the MIME type string passed in.
This method is never invoked by this implementation.
- Overrides:
normalizeMimeType
in classDataFlavor
- Parameters:
mimeType
- the MIME type- Returns:
- the normalized MIME type
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Submit a bug or feature
Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.
PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!