java.awt.datatransfer.DataFlavor

  • このエントリーをはてなブックマークに追加
  • Pocket

WindowsXP ExplorerからファイルをDnD(drag&drop:ドラッグ&ドロップ)したときのjava.awt.datatransfer.DataFlavor。
e.getCurrentDataFlavors() してみると、 1つのDataFlavorが返り、その内容は、


java.awt.datatransfer.DataFlavor[mimetype=application/x-java-file-list;representationclass=java.util.List]

でした。(java v1.5_10)

一方linux/fedora core 6でNautilusからのアイコンドロップによるDataFlavorを取得してみると、
個数は47個で、内容は以下の通りでした。(java v1.5_09)


java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=java.io.Reader]
java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=java.lang.String]
java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=java.nio.CharBuffer]
java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=[C]
java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=java.nio.ByteBuffer;charset=UTF-16]
java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=[B;charset=UTF-16]
java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=java.io.InputStream;charset=UTF-8]
java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=java.nio.ByteBuffer;charset=UTF-8]
java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=[B;charset=UTF-8]
java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=java.io.InputStream;charset=UTF-16BE]
java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=java.nio.ByteBuffer;charset=UTF-16BE]
java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=[B;charset=UTF-16BE]
java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=java.io.InputStream;charset=UTF-16LE]
java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=java.nio.ByteBuffer;charset=UTF-16LE]
java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=[B;charset=UTF-16LE]
java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=java.io.InputStream;charset=ISO-8859-1]
java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=java.nio.ByteBuffer;charset=ISO-8859-1]
java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=[B;charset=ISO-8859-1]
java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=java.io.InputStream;charset=US-ASCII]
java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=java.nio.ByteBuffer;charset=US-ASCII]
java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=[B;charset=US-ASCII]
java.awt.datatransfer.DataFlavor[mimetype=application/x-java-serialized-object;representationclass=java.lang.String]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.io.Reader]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.lang.String]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.nio.CharBuffer]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=[C]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.nio.ByteBuffer;charset=UTF-16]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.io.InputStream;charset=UTF-8]
java.awt.datatransfer.DataFlavor[mimetype=x-special/gnome-icon-list;representationclass=java.io.InputStream]
java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=java.io.InputStream;charset=UTF-16]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.io.InputStream;charset=UTF-16]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=[B;charset=UTF-16]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.nio.ByteBuffer;charset=UTF-8]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=[B;charset=UTF-8]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.io.InputStream;charset=UTF-16BE]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.nio.ByteBuffer;charset=UTF-16BE]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=[B;charset=UTF-16BE]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.io.InputStream;charset=UTF-16LE]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.nio.ByteBuffer;charset=UTF-16LE]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=[B;charset=UTF-16LE]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.io.InputStream;charset=unicode]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.io.InputStream;charset=ISO-8859-1]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.nio.ByteBuffer;charset=ISO-8859-1]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=[B;charset=ISO-8859-1]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.io.InputStream;charset=US-ASCII]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.nio.ByteBuffer;charset=US-ASCII]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=[B;charset=US-ASCII]

Nautilusの一覧表示からのドラッグ&ドロップでは
DataFlavorは以下の23個でした。


java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=java.io.Reader]
java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=java.lang.String]
java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=java.nio.CharBuffer]
java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=[C]
java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=java.nio.ByteBuffer;charset=UTF-16]
java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=[B;charset=UTF-16]
java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=java.io.InputStream;charset=UTF-8]
java.awt.datatransfer.DataFlavor[mimetype=x-special/gnome-icon-list;representationclass=java.io.InputStream]
java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=java.io.InputStream;charset=UTF-16]
java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=java.nio.ByteBuffer;charset=UTF-8]
java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=[B;charset=UTF-8]
java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=java.io.InputStream;charset=UTF-16BE]
java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=java.nio.ByteBuffer;charset=UTF-16BE]
java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=[B;charset=UTF-16BE]
java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=java.io.InputStream;charset=UTF-16LE]
java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=java.nio.ByteBuffer;charset=UTF-16LE]
java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=[B;charset=UTF-16LE]
java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=java.io.InputStream;charset=ISO-8859-1]
java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=java.nio.ByteBuffer;charset=ISO-8859-1]
java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=[B;charset=ISO-8859-1]
java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=java.io.InputStream;charset=US-ASCII]
java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=java.nio.ByteBuffer;charset=US-ASCII]
java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;representationclass=[B;charset=US-ASCII]

application/x-java-file-list;class=java.util.List
がMIME「Content-Type」に指定されていないので、取り扱いが面倒です。アイコン表示でも、一覧表示でもファイルのドロップをサポートするには、text/uri-listに対応する必要がありそうです。

コードはこちらに載せました。

beizのノート ネイティヴからjava/swing(awt)へのドラッグ&ドロップ
http://beiz.blog76.fc2.com/blog-entry-520.html

  • このエントリーをはてなブックマークに追加
  • Pocket

コメントを残す