etf.org/rfc/rfc2045.txt">RFC 2045 and
RFC 2046. A content type is typically referred to as a MIME type.
A content type consists of a media type (referred to as the primary type), a subtype, and optional parameters. See RFC 2045 for details on the syntax of a MIME type.
The JRE data transfer implementation interprets the parameter "class" of a MIME type as a representation class. The representation class reflects the class of the object being transferred. In other words, the representation class is the type of object returned by {@link Transferable#getTransferData}. For example, the MIME type of {@link #imageFlavor} is{@code "image/x-java-image;class=java.awt.Image"}, the primary type is {@code image}, the subtype is {@code x-java-image}, and the representation class is {@code java.awt.Image}. When {@code getTransferData} is invokedwith a {@code DataFlavor} of {@code imageFlavor}, an instance of {@code java.awt.Image} is returned.It's important to note that {@code DataFlavor} does no error checkingagainst the representation class. It is up to consumers of {@code DataFlavor}, such as {@code Transferable}, to honor the representation class.
Note, if you do not specify a representation class when creating a {@code DataFlavor}, the default representation class is used. See appropriate documentation for {@code DataFlavor}'s constructors.
Also, {@code DataFlavor} instances with the "text" primaryMIME type may have a "charset" parameter. Refer to RFC 2046 and {@link #selectBestTextFlavor} for details on "text" MIME typesand the "charset" parameter.
Equality of {@code DataFlavors} is determined by the primary type,subtype, and representation class. Refer to {@link #equals(DataFlavor)} fordetails. When determining equality, any optional parameters are ignored. For example, the following produces two {@code DataFlavors} thatare considered identical:
DataFlavor flavor1 = new DataFlavor(Object.class, "X-test/test; class=<java.lang.Object>; foo=bar"); DataFlavor flavor2 = new DataFlavor(Object.class, "X-test/test; class=<java.lang.Object>; x=y"); // The following returns true. flavor1.equals(flavor2);
As mentioned, {@code flavor1} and {@code flavor2} are considered identical.As such, asking a {@code Transferable} for either {@code DataFlavor} returnsthe same results.
For more information on the using data transfer with Swing see the How to Use Drag and Drop and Data Transfer, section in Java Tutorial.
@version 1.83, 07/28/06
@author Blake Sullivan
@author Laurence P. G. Cable
@author Jeff Dunn