< prev index next >

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

Print this page




  95  * For example, the following produces two {@code DataFlavors} that
  96  * are considered identical:
  97  * <pre>
  98  *   DataFlavor flavor1 = new DataFlavor(Object.class, &quot;X-test/test; class=&lt;java.lang.Object&gt;; foo=bar&quot;);
  99  *   DataFlavor flavor2 = new DataFlavor(Object.class, &quot;X-test/test; class=&lt;java.lang.Object&gt;; x=y&quot;);
 100  *   // The following returns true.
 101  *   flavor1.equals(flavor2);
 102  * </pre>
 103  * As mentioned, {@code flavor1} and {@code flavor2} are considered identical.
 104  * As such, asking a {@code Transferable} for either {@code DataFlavor} returns
 105  * the same results.
 106  * <p>
 107  * For more information on using data transfer with Swing see
 108  * the <a href="http://docs.oracle.com/javase/tutorial/uiswing/dnd/index.html">
 109  * How to Use Drag and Drop and Data Transfer</a>,
 110  * section in <em>Java Tutorial</em>.
 111  *
 112  * @author      Blake Sullivan
 113  * @author      Laurence P. G. Cable
 114  * @author      Jeff Dunn

 115  */
 116 public class DataFlavor implements Externalizable, Cloneable {
 117 
 118     private static final long serialVersionUID = 8367026044764648243L;
 119     private static final Class<InputStream> ioInputStreamClass = InputStream.class;
 120 
 121     /**
 122      * Tries to load a class from: the bootstrap loader, the system loader,
 123      * the context loader (if one is present) and finally the loader specified.
 124      *
 125      * @param className the name of the class to be loaded
 126      * @param fallback the fallback loader
 127      * @return the class loaded
 128      * @exception ClassNotFoundException if class is not found
 129      */
 130     protected static final Class<?> tryToLoadClass(String className,
 131                                                    ClassLoader fallback)
 132         throws ClassNotFoundException
 133     {
 134         ReflectUtil.checkPackageAccess(className);




  95  * For example, the following produces two {@code DataFlavors} that
  96  * are considered identical:
  97  * <pre>
  98  *   DataFlavor flavor1 = new DataFlavor(Object.class, &quot;X-test/test; class=&lt;java.lang.Object&gt;; foo=bar&quot;);
  99  *   DataFlavor flavor2 = new DataFlavor(Object.class, &quot;X-test/test; class=&lt;java.lang.Object&gt;; x=y&quot;);
 100  *   // The following returns true.
 101  *   flavor1.equals(flavor2);
 102  * </pre>
 103  * As mentioned, {@code flavor1} and {@code flavor2} are considered identical.
 104  * As such, asking a {@code Transferable} for either {@code DataFlavor} returns
 105  * the same results.
 106  * <p>
 107  * For more information on using data transfer with Swing see
 108  * the <a href="http://docs.oracle.com/javase/tutorial/uiswing/dnd/index.html">
 109  * How to Use Drag and Drop and Data Transfer</a>,
 110  * section in <em>Java Tutorial</em>.
 111  *
 112  * @author      Blake Sullivan
 113  * @author      Laurence P. G. Cable
 114  * @author      Jeff Dunn
 115  * @since 1.1
 116  */
 117 public class DataFlavor implements Externalizable, Cloneable {
 118 
 119     private static final long serialVersionUID = 8367026044764648243L;
 120     private static final Class<InputStream> ioInputStreamClass = InputStream.class;
 121 
 122     /**
 123      * Tries to load a class from: the bootstrap loader, the system loader,
 124      * the context loader (if one is present) and finally the loader specified.
 125      *
 126      * @param className the name of the class to be loaded
 127      * @param fallback the fallback loader
 128      * @return the class loaded
 129      * @exception ClassNotFoundException if class is not found
 130      */
 131     protected static final Class<?> tryToLoadClass(String className,
 132                                                    ClassLoader fallback)
 133         throws ClassNotFoundException
 134     {
 135         ReflectUtil.checkPackageAccess(className);


< prev index next >