1. /*
  2. * @(#)Transferable.java 1.8 00/02/02
  3. *
  4. * Copyright 1996-2000 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. package java.awt.datatransfer;
  11. import java.io.IOException;
  12. /**
  13. * Defines the interface for classes that can be used to provide data
  14. * for a transfer operation.
  15. *
  16. * @version 1.8, 02/02/00
  17. * @author Amy Fowler
  18. */
  19. public interface Transferable {
  20. /**
  21. * Returns an array of DataFlavor objects indicating the flavors the data
  22. * can be provided in. The array should be ordered according to preference
  23. * for providing the data (from most richly descriptive to least descriptive).
  24. * @return an array of data flavors in which this data can be transferred
  25. */
  26. public DataFlavor[] getTransferDataFlavors();
  27. /**
  28. * Returns whether or not the specified data flavor is supported for
  29. * this object.
  30. * @param flavor the requested flavor for the data
  31. * @return boolean indicating wjether or not the data flavor is supported
  32. */
  33. public boolean isDataFlavorSupported(DataFlavor flavor);
  34. /**
  35. * Returns an object which represents the data to be transferred. The class
  36. * of the object returned is defined by the representation class of the flavor.
  37. *
  38. * @param flavor the requested flavor for the data
  39. * @see DataFlavor#getRepresentationClass
  40. * @exception IOException if the data is no longer available
  41. * in the requested flavor.
  42. * @exception UnsupportedFlavorException if the requested data flavor is
  43. * not supported.
  44. */
  45. public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException;
  46. }