1. /*
  2. * @(#)Transferable.java 1.11 03/01/23
  3. *
  4. * Copyright 2003 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. *
  13. * @version 1.11, 01/23/03
  14. * @author Amy Fowler
  15. */
  16. public interface Transferable {
  17. /**
  18. * Returns an array of DataFlavor objects indicating the flavors the data
  19. * can be provided in. The array should be ordered according to preference
  20. * for providing the data (from most richly descriptive to least descriptive).
  21. * @return an array of data flavors in which this data can be transferred
  22. */
  23. public DataFlavor[] getTransferDataFlavors();
  24. /**
  25. * Returns whether or not the specified data flavor is supported for
  26. * this object.
  27. * @param flavor the requested flavor for the data
  28. * @return boolean indicating whether or not the data flavor is supported
  29. */
  30. public boolean isDataFlavorSupported(DataFlavor flavor);
  31. /**
  32. * Returns an object which represents the data to be transferred. The class
  33. * of the object returned is defined by the representation class of the flavor.
  34. *
  35. * @param flavor the requested flavor for the data
  36. * @see DataFlavor#getRepresentationClass
  37. * @exception IOException if the data is no longer available
  38. * in the requested flavor.
  39. * @exception UnsupportedFlavorException if the requested data flavor is
  40. * not supported.
  41. */
  42. public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException;
  43. }