1. /*
  2. * @(#)Transferable.java 1.13 03/12/19
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package java.awt.datatransfer;
  8. import java.io.IOException;
  9. /**
  10. * Defines the interface for classes that can be used to provide data
  11. * for a transfer operation.
  12. * <p>
  13. * For information on using data transfer with Swing, see
  14. * <a href="http://java.sun.com/docs/books/tutorial/uiswing/misc/dnd.html">
  15. * How to Use Drag and Drop and Data Transfer</a>,
  16. * a section in <em>The Java Tutorial</em>, for more information.
  17. *
  18. * @version 1.13, 12/19/03
  19. * @author Amy Fowler
  20. */
  21. public interface Transferable {
  22. /**
  23. * Returns an array of DataFlavor objects indicating the flavors the data
  24. * can be provided in. The array should be ordered according to preference
  25. * for providing the data (from most richly descriptive to least descriptive).
  26. * @return an array of data flavors in which this data can be transferred
  27. */
  28. public DataFlavor[] getTransferDataFlavors();
  29. /**
  30. * Returns whether or not the specified data flavor is supported for
  31. * this object.
  32. * @param flavor the requested flavor for the data
  33. * @return boolean indicating whether or not the data flavor is supported
  34. */
  35. public boolean isDataFlavorSupported(DataFlavor flavor);
  36. /**
  37. * Returns an object which represents the data to be transferred. The class
  38. * of the object returned is defined by the representation class of the flavor.
  39. *
  40. * @param flavor the requested flavor for the data
  41. * @see DataFlavor#getRepresentationClass
  42. * @exception IOException if the data is no longer available
  43. * in the requested flavor.
  44. * @exception UnsupportedFlavorException if the requested data flavor is
  45. * not supported.
  46. */
  47. public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException;
  48. }