Path: blob/master/src/java.datatransfer/share/classes/java/awt/datatransfer/Transferable.java
41159 views
/*1* Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package java.awt.datatransfer;2627import java.io.IOException;2829/**30* Defines the interface for classes that can be used to provide data for a31* transfer operation.32* <p>33* For information on using data transfer with Swing, see34* <a href="http://docs.oracle.com/javase/tutorial/uiswing/dnd/index.html">35* How to Use Drag and Drop and Data Transfer</a>, a section in36* <em>The Java Tutorial</em>, for more information.37*38* @author Amy Fowler39* @since 1.140*/41public interface Transferable {4243/**44* Returns an array of DataFlavor objects indicating the flavors the data45* can be provided in. The array should be ordered according to preference46* for providing the data (from most richly descriptive to least47* descriptive).48*49* @return an array of data flavors in which this data can be transferred50*/51public DataFlavor[] getTransferDataFlavors();5253/**54* Returns whether or not the specified data flavor is supported for this55* object.56*57* @param flavor the requested flavor for the data58* @return boolean indicating whether or not the data flavor is supported59*/60public boolean isDataFlavorSupported(DataFlavor flavor);6162/**63* Returns an object which represents the data to be transferred. The class64* of the object returned is defined by the representation class of the65* flavor.66*67* @param flavor the requested flavor for the data68* @return an object which represents the data to be transferred69* @throws IOException if the data is no longer available in the requested70* flavor71* @throws UnsupportedFlavorException if the requested data flavor is not72* supported73* @see DataFlavor#getRepresentationClass74*/75public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException;76}777879