Posted on 2012-08-30 11:59
penngo 阅读(581)
评论(0) 编辑 收藏 所属分类:
Java
Clipboard clip = Toolkit.getDefaultToolkit()
.getSystemClipboard();
Transferable trans = clip.getContents(this);
DataFlavor[] flavors = trans.getTransferDataFlavors();
try {
for (DataFlavor cur : flavors) {
if (cur.isMimeTypeEqual("text/plain")) {
Reader r = (Reader) trans.getTransferData(cur);
BufferedReader br = new BufferedReader(r);
String src = br.readLine();
if (src.startsWith("http://")
|| src.startsWith("https://")) {
map.put("url", src);
}
br.close();
break;
}
}
} catch (Exception e) {
System.out.println("===newDownloadInit:" + e.getMessage());
}