ActivationDataFlavor (Java EE 5 SDK)

Java

Java EE 5 SDK

深圳电信培训中心.徐海蛟老师.


javax.activation Class ActivationDataFlavor

java.lang.Object
  extended by java.awt.datatransfer.DataFlavor
      extended by javax.activation.ActivationDataFlavor
所有已实现的接口:
Externalizable, Serializable, Cloneable

public class ActivationDataFlavor
extends 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.

另请参见:
Serialized Form

字段摘要
 
Fields inherited from class java.awt.datatransfer.DataFlavor
imageFlavor, javaFileListFlavor, javaJVMLocalObjectMimeType, javaRemoteObjectMimeType, javaSerializedObjectMimeType, plainTextFlavor, stringFlavor
 
构造器摘要
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.
 
方法摘要
 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.
 
类方法继承 java.awt.datatransfer.DataFlavor
clone, equals, equals, getDefaultRepresentationClass, getDefaultRepresentationClassAsString, getParameter, getPrimaryType, getReaderForText, getSubType, getTextPlainUnicodeFlavor, hashCode, isFlavorJavaFileListType, isFlavorRemoteObjectType, isFlavorSerializedObjectType, isFlavorTextType, isMimeTypeEqual, isMimeTypeSerializedObject, isRepresentationClassByteBuffer, isRepresentationClassCharBuffer, isRepresentationClassInputStream, isRepresentationClassReader, isRepresentationClassRemote, isRepresentationClassSerializable, match, readExternal, selectBestTextFlavor, toString, tryToLoadClass, writeExternal
 
类方法继承 java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

构造器详细信息

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

参数:
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


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

参数:
representationClass - the class used in this DataFlavor
humanPresentableName - the human presentable name of the 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

参数:
mimeType - the MIME type of the data represented by this class
humanPresentableName - the human presentable name of the flavor

方法详细信息

getMimeType

public String getMimeType()
Return the MIME type for this DataFlavor.

重写:
getMimeType in class DataFlavor
返回:
the MIME type

getRepresentationClass

public Class getRepresentationClass()
Return the representation class.

重写:
getRepresentationClass in class DataFlavor
返回:
the representation class

getHumanPresentableName

public String getHumanPresentableName()
Return the Human Presentable name.

重写:
getHumanPresentableName in class DataFlavor
返回:
the human presentable name

setHumanPresentableName

public void setHumanPresentableName(String humanPresentableName)
Set the human presentable name.

重写:
setHumanPresentableName in class DataFlavor
参数:
humanPresentableName - the name to set

equals

public boolean equals(DataFlavor dataFlavor)
Compares the DataFlavor passed in with this DataFlavor; calls the isMimeTypeEqual method.

重写:
equals in class DataFlavor
参数:
dataFlavor - the DataFlavor to compare with
返回:
true if the MIME type and representation class are the same

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.

重写:
isMimeTypeEqual in class DataFlavor
参数:
mimeType - the MIME type
返回:
true if the same MIME type

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.

重写:
normalizeMimeTypeParameter in class DataFlavor
参数:
parameterName - the parameter name
parameterValue - the parameter value
返回:
the normalized parameter value

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.

重写:
normalizeMimeType in class DataFlavor
参数:
mimeType - the MIME type
返回:
the normalized MIME type

Java EE 5 SDK

深圳电信培训中心.徐海蛟老师.


提交错误或意见

版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。深圳电信培训中心.徐海蛟老师教学参考.