1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package net.sf.jhylafax.addressbook;
21
22 import java.awt.datatransfer.DataFlavor;
23 import java.awt.datatransfer.Transferable;
24 import java.awt.datatransfer.UnsupportedFlavorException;
25 import java.io.IOException;
26 import java.io.InputStream;
27
28 public class ContactTransferable implements Transferable
29 {
30 public final static DataFlavor VCARD_FLAVOR
31 = new DataFlavor("text/x-vcard;class=java.io.InputStream", "vCard");
32
33
34 private InputStream in;
35
36 public ContactTransferable(InputStream in)
37 {
38 this.in = in;
39 }
40
41 public DataFlavor[] getTransferDataFlavors()
42 {
43 return new DataFlavor[] { VCARD_FLAVOR };
44 }
45
46 public boolean isDataFlavorSupported(DataFlavor flavor)
47 {
48 return VCARD_FLAVOR.equals(flavor);
49 }
50
51 public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException
52 {
53 return in;
54 }
55
56 }