Atitit 剪贴板数据类型 DataFlavor
目录
representationClass = String
* mimeType = "text/html"
* <pre>
* representationClass = String
* mimeType = "text/html"
* </pre>
*/
public static DataFlavor selectionHtmlFlavor
representationClass = String
* mimeType = "text/html"
* </pre>
*/
public static DataFlavor fragmentHtmlFlavor
* <pre>
* representationClass = java.awt.Image
* mimeType = "image/x-java-image"
* </pre>
*/
public static final DataFlavor imageFlavor
public static final String javaSerializedObjectMimeType = "application/x-java-serialized-object";
/**
* To transfer a list of files to/from Java (and the underlying
* platform) a <code>DataFlavor</code> of this type/subtype and
* representation class of <code>java.util.List</code> is used.
* Each element of the list is required/guaranteed to be of type
* <code>java.io.File</code>.
*/
public static final DataFlavor javaFileListFlavor = createConstant("application/x-java-file-list;class=java.util.List", null);
* The <code>DataFlavor</code> representing plain text with Unicode
* encoding, where:
* <pre>
* representationClass = InputStream
* mimeType = "text/plain; charset=unicode"
* </pre>
* This <code>DataFlavor</code> has been <b>deprecated</b> because
* (1) Its representation is an InputStream, an 8-bit based representation,
* while Unicode is a 16-bit character set; and (2) The charset "unicode"
* is not well-defined. "unicode" implies a particular platform's
* implementation of Unicode, not a cross-platform implementation.
*
* @deprecated as of 1.3. Use <code>DataFlavor.getReaderForText(Transferable)</code>
* instead of <code>Transferable.getTransferData(DataFlavor.plainTextFlavor)</code>.
*/
@Deprecated
public static final DataFlavor = createConstant("text/plain; charset=unicode; class=java.io.InputStream", "Plain Text");plainTextFlavor
* The <code>DataFlavor</code> representing a Java Unicode String class,
* where:
* <pre>
* representationClass = java.lang.String
* mimeType = "application/x-java-serialized-object"
* </pre>
*/
Pu
/bookmarksHtmlEverythingIndexPrj/src/agenepkg/clip.java
package agenepkg;
import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.io.File;
import java.io.IOException;
import java.util.List;
@SuppressWarnings("all")
public class clip {
public static void main(String[] args) throws UnsupportedFlavorException, IOException {
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
Transferable Transferable1_clipboardContent = clipboard.getContents(null);
// 获取文本中的Transferable对象
if (Transferable1_clipboardContent == null)
return;
if (!Transferable1_clipboardContent.isDataFlavorSupported(DataFlavor.javaFileListFlavor))
return;
List<File> list = (List<File>) (Transferable1_clipboardContent.getTransferData(DataFlavor.javaFileListFlavor));
for (File file : list) {
System.out.println(file);
}
}
}