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

Print this page




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




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