ActivationDataFlavor (Java EE 5)

Java EE API


javax.activation Class ActivationDataFlavor

java.lang.Object
  extended by java.awt.datatransfer.DataFlavor
      extended by javax.activation.ActivationDataFlavor
All Implemented Interfaces:
Externalizable, Serializable, Cloneable

public class ActivationDataFlavor
extends DataFlavor

Extends: java.awt.datatransfer.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
 
Constructor Summary
 
Method Summary
 boolean
 String
 String
 Class
 boolean
protected  String
protected  String
 void
 
Methods inherited from class java.awt.datatransfer.DataFlavor
 
Methods inherited from class java.lang.Object
 

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 DataFlavor
mimeType - the MIME type of the data represented by this class
humanPresentableName - the human presentable name of the flavor


public ActivationDataFlavor(Class<T> representationClass, String humanPresentableName)
构造一个表示 MimeTypeDataFlavor

返回的 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 DataFlavor
humanPresentableName - 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 class
humanPresentableName - 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 class DataFlavor
Returns:
the MIME type

public Class<T> getRepresentationClass()
返回表示形式类。
return 表示形式类
英文文档:

getRepresentationClass

public Class getRepresentationClass()
Return the representation class.

Overrides:
getRepresentationClass in class DataFlavor
Returns:
the representation class

public String getHumanPresentableName()
返回得体的名称。
return 得体的名称
英文文档:

getHumanPresentableName

public String getHumanPresentableName()
Return the Human Presentable name.

Overrides:
getHumanPresentableName in class DataFlavor
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 class DataFlavor
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 class DataFlavor
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 class DataFlavor
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 class DataFlavor
Parameters:
parameterName - the parameter name
parameterValue - 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 class DataFlavor
Parameters:
mimeType - the MIME type
Returns:
the normalized MIME type


Submit a bug or feature

Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.

一看就知道只有菜鸟才干这么无知的事啦。

PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!