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