src/share/classes/java/awt/datatransfer/DataFlavor.java

Print this page




  91  * <a href="http://www.ietf.org/rfc/rfc2046.txt">RFC 2046</a> and
  92  * {@link #selectBestTextFlavor} for details on &quot;text&quot; MIME types
  93  * and the &quot;charset&quot; parameter.
  94  * <p>
  95  * Equality of {@code DataFlavors} is determined by the primary type,
  96  * subtype, and representation class. Refer to {@link #equals(DataFlavor)} for
  97  * details. When determining equality, any optional parameters are ignored.
  98  * For example, the following produces two {@code DataFlavors} that
  99  * are considered identical:
 100  * <pre>
 101  *   DataFlavor flavor1 = new DataFlavor(Object.class, &quot;X-test/test; class=&lt;java.lang.Object&gt;; foo=bar&quot;);
 102  *   DataFlavor flavor2 = new DataFlavor(Object.class, &quot;X-test/test; class=&lt;java.lang.Object&gt;; x=y&quot;);
 103  *   // The following returns true.
 104  *   flavor1.equals(flavor2);
 105  * </pre>
 106  * As mentioned, {@code flavor1} and {@code flavor2} are considered identical.
 107  * As such, asking a {@code Transferable} for either {@code DataFlavor} returns
 108  * the same results.
 109  * <p>
 110  * For more information on the using data transfer with Swing see
 111  * the <a href="http://docs.oracle.com/javase/tutorial/uiswing/dnd/index.html">
 112  * How to Use Drag and Drop and Data Transfer</a>,
 113  * section in <em>Java Tutorial</em>.
 114  *
 115  * @author      Blake Sullivan
 116  * @author      Laurence P. G. Cable
 117  * @author      Jeff Dunn
 118  */
 119 public class DataFlavor implements Externalizable, Cloneable {
 120 
 121     private static final long serialVersionUID = 8367026044764648243L;
 122     private static final Class<InputStream> ioInputStreamClass = InputStream.class;
 123 
 124     /**
 125      * Tries to load a class from: the bootstrap loader, the system loader,
 126      * the context loader (if one is present) and finally the loader specified.
 127      *
 128      * @param className the name of the class to be loaded
 129      * @param fallback the fallback loader
 130      * @return the class loaded
 131      * @exception ClassNotFoundException if class is not found




  91  * <a href="http://www.ietf.org/rfc/rfc2046.txt">RFC 2046</a> and
  92  * {@link #selectBestTextFlavor} for details on &quot;text&quot; MIME types
  93  * and the &quot;charset&quot; parameter.
  94  * <p>
  95  * Equality of {@code DataFlavors} is determined by the primary type,
  96  * subtype, and representation class. Refer to {@link #equals(DataFlavor)} for
  97  * details. When determining equality, any optional parameters are ignored.
  98  * For example, the following produces two {@code DataFlavors} that
  99  * are considered identical:
 100  * <pre>
 101  *   DataFlavor flavor1 = new DataFlavor(Object.class, &quot;X-test/test; class=&lt;java.lang.Object&gt;; foo=bar&quot;);
 102  *   DataFlavor flavor2 = new DataFlavor(Object.class, &quot;X-test/test; class=&lt;java.lang.Object&gt;; x=y&quot;);
 103  *   // The following returns true.
 104  *   flavor1.equals(flavor2);
 105  * </pre>
 106  * As mentioned, {@code flavor1} and {@code flavor2} are considered identical.
 107  * As such, asking a {@code Transferable} for either {@code DataFlavor} returns
 108  * the same results.
 109  * <p>
 110  * For more information on the using data transfer with Swing see
 111  * the <a href="https://docs.oracle.com/javase/tutorial/uiswing/dnd/index.html">
 112  * How to Use Drag and Drop and Data Transfer</a>,
 113  * section in <em>Java Tutorial</em>.
 114  *
 115  * @author      Blake Sullivan
 116  * @author      Laurence P. G. Cable
 117  * @author      Jeff Dunn
 118  */
 119 public class DataFlavor implements Externalizable, Cloneable {
 120 
 121     private static final long serialVersionUID = 8367026044764648243L;
 122     private static final Class<InputStream> ioInputStreamClass = InputStream.class;
 123 
 124     /**
 125      * Tries to load a class from: the bootstrap loader, the system loader,
 126      * the context loader (if one is present) and finally the loader specified.
 127      *
 128      * @param className the name of the class to be loaded
 129      * @param fallback the fallback loader
 130      * @return the class loaded
 131      * @exception ClassNotFoundException if class is not found