Class ActivationDataFlavor
- java.lang.Object
-
- javax.activation.ActivationDataFlavor
-
public class ActivationDataFlavor extends java.lang.ObjectThe ActivationDataFlavor class is a special subclass ofjava.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 theequalsmethod. Except for the improved parsing, its semantics are identical to that of the JDK's DataFlavor class.
-
-
Constructor Summary
Constructors Constructor Description ActivationDataFlavor(java.lang.Class representationClass, java.lang.String humanPresentableName)Construct a DataFlavor that represents a MimeType.ActivationDataFlavor(java.lang.Class representationClass, java.lang.String mimeType, java.lang.String humanPresentableName)Construct a DataFlavor that represents an arbitrary Java object.ActivationDataFlavor(java.lang.String mimeType, java.lang.String humanPresentableName)Construct a DataFlavor that represents a MimeType.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleanequals(ActivationDataFlavor dataFlavor)Compares the DataFlavor passed in with this DataFlavor; calls theisMimeTypeEqualmethod.java.lang.StringgetHumanPresentableName()Return the Human Presentable name.java.lang.StringgetMimeType()Return the MIME type for this DataFlavor.java.lang.ClassgetRepresentationClass()Return the representation class.booleanisMimeTypeEqual(java.lang.String mimeType)Is the string representation of the MIME type passed in equivalent to the MIME type of this DataFlavor.protected java.lang.StringnormalizeMimeType(java.lang.String mimeType)Deprecated.protected java.lang.StringnormalizeMimeTypeParameter(java.lang.String parameterName, java.lang.String parameterValue)Deprecated.voidsetHumanPresentableName(java.lang.String humanPresentableName)Set the human presentable name.
-
-
-
Constructor Detail
-
ActivationDataFlavor
public ActivationDataFlavor(java.lang.Class representationClass, java.lang.String mimeType, java.lang.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
-
ActivationDataFlavor
public ActivationDataFlavor(java.lang.Class representationClass, java.lang.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
-
ActivationDataFlavor
public ActivationDataFlavor(java.lang.String mimeType, java.lang.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
-
getMimeType
public java.lang.String getMimeType()
Return the MIME type for this DataFlavor.- Returns:
- the MIME type
-
getRepresentationClass
public java.lang.Class getRepresentationClass()
Return the representation class.- Returns:
- the representation class
-
getHumanPresentableName
public java.lang.String getHumanPresentableName()
Return the Human Presentable name.- Returns:
- the human presentable name
-
setHumanPresentableName
public void setHumanPresentableName(java.lang.String humanPresentableName)
Set the human presentable name.- Parameters:
humanPresentableName- the name to set
-
equals
public boolean equals(ActivationDataFlavor dataFlavor)
Compares the DataFlavor passed in with this DataFlavor; calls theisMimeTypeEqualmethod.- Parameters:
dataFlavor- the DataFlavor to compare with- Returns:
- true if the MIME type and representation class are the same
-
isMimeTypeEqual
public boolean isMimeTypeEqual(java.lang.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 Jakarta Activation. This provides a more robust comparison than is normally available in the DataFlavor class.
- Parameters:
mimeType- the MIME type- Returns:
- true if the same MIME type
-
normalizeMimeTypeParameter
protected java.lang.String normalizeMimeTypeParameter(java.lang.String parameterName, java.lang.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.
- Parameters:
parameterName- the parameter nameparameterValue- the parameter value- Returns:
- the normalized parameter value
-
normalizeMimeType
protected java.lang.String normalizeMimeType(java.lang.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.- Parameters:
mimeType- the MIME type- Returns:
- the normalized MIME type
-
-