1 21 22 27 package com.sun.mail.handlers; 28 29 import java.io.*; 30 import java.awt.datatransfer.DataFlavor ; 31 import javax.activation.*; 32 import javax.mail.MessagingException ; 33 import javax.mail.internet.*; 34 35 36 public class multipart_mixed implements DataContentHandler { 37 private ActivationDataFlavor myDF = new ActivationDataFlavor( 38 javax.mail.internet.MimeMultipart .class, 39 "multipart/mixed", 40 "Multipart"); 41 42 47 public DataFlavor [] getTransferDataFlavors() { return new DataFlavor [] { myDF }; 49 } 50 51 58 public Object getTransferData(DataFlavor df, DataSource ds) { 59 if (myDF.equals(df)) 62 return getContent(ds); 63 else 64 return null; 65 } 66 67 70 public Object getContent(DataSource ds) { 71 try { 72 return new MimeMultipart(ds); 73 } catch (MessagingException e) { 74 return null; 75 } 76 } 77 78 81 public void writeTo(Object obj, String mimeType, OutputStream os) 82 throws IOException { 83 if (obj instanceof MimeMultipart) { 84 try { 85 ((MimeMultipart)obj).writeTo(os); 86 } catch (MessagingException e) { 87 throw new IOException(e.toString()); 88 } 89 } 90 } 91 } 92 | Popular Tags |