- java.lang.Object
-
- java.awt.datatransfer.DataFlavor
-
- javax.activation.ActivationDataFlavor
-
- All Implemented Interfaces:
- Externalizable, Serializable, Cloneable
public class ActivationDataFlavor extends DataFlavor
The 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 theequals
method. Except for the improved parsing, its semantics are identical to that of the JDK's DataFlavor class.- Since:
- 1.6
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class java.awt.datatransfer.DataFlavor
imageFlavor, javaFileListFlavor, javaJVMLocalObjectMimeType, javaRemoteObjectMimeType, javaSerializedObjectMimeType, plainTextFlavor, stringFlavor
-
-
Constructor Summary
Constructors Constructor and Description 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
Methods Modifier and Type Method and Description boolean
equals(DataFlavor dataFlavor)
Compares the DataFlavor passed in with this DataFlavor; calls theisMimeTypeEqual
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.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
-
-
-
-
Constructor Detail
-
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
-
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
-
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
-
getMimeType
public String getMimeType()
Return the MIME type for this DataFlavor.- Overrides:
getMimeType
in classDataFlavor
- Returns:
- the MIME type
-
getRepresentationClass
public Class getRepresentationClass()
Return the representation class.- Overrides:
getRepresentationClass
in classDataFlavor
- Returns:
- the representation class
-
getHumanPresentableName
public String getHumanPresentableName()
Return the Human Presentable name.- Overrides:
getHumanPresentableName
in classDataFlavor
- Returns:
- the human presentable name
-
setHumanPresentableName
public void setHumanPresentableName(String humanPresentableName)
Set the human presentable name.- Overrides:
setHumanPresentableName
in classDataFlavor
- Parameters:
humanPresentableName
- the name to set
-
equals
public boolean equals(DataFlavor dataFlavor)
Compares the DataFlavor passed in with this DataFlavor; calls theisMimeTypeEqual
method.- Overrides:
equals
in classDataFlavor
- Parameters:
dataFlavor
- the DataFlavor to compare with- Returns:
- true if the MIME type and representation class are the same
- See Also:
DataFlavor.selectBestTextFlavor(java.awt.datatransfer.DataFlavor[])
-
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
-
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
-
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
-
-
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 11/06/2005 gemaakt, de laatste keer de 04/03/2020 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-rf-javax/activation/activationdataflavor.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
Referenties
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.