FileDocCategorySizeDatePackage
message_deliverystatus.javaAPI DocGlassfish v2 API4501Mon May 14 15:28:42 BST 2007com.sun.mail.dsn

message_deliverystatus

public class message_deliverystatus extends Object implements DataContentHandler
version
1.4, 07/05/04

Fields Summary
ActivationDataFlavor
ourDataFlavor
Constructors Summary
Methods Summary
public java.lang.ObjectgetContent(javax.activation.DataSource ds)
Return the content.

	// create a new DeliveryStatus
	try {
	    /*
	    Session session;
	    if (ds instanceof MessageAware) {
		javax.mail.MessageContext mc =
			((MessageAware)ds).getMessageContext();
		session = mc.getSession();
	    } else {
		// Hopefully a rare case.  Also hopefully the application
		// has created a default Session that can just be returned
		// here.  If not, the one we create here is better than
		// nothing, but overall not a really good answer.
		session = Session.getDefaultInstance(new Properties(), null);
	    }
	    return new DeliveryStatus(session, ds.getInputStream());
	    */
	    return new DeliveryStatus(ds.getInputStream());
	} catch (MessagingException me) {
	    throw new IOException("Exception creating DeliveryStatus in " +
		    "message/devliery-status DataContentHandler: " +
		    me.toString());
	}
    
public java.lang.ObjectgetTransferData(java.awt.datatransfer.DataFlavor df, javax.activation.DataSource ds)
return the Transfer Data of type DataFlavor from InputStream

param
df The DataFlavor.
param
ins The InputStream corresponding to the data.
return
a Message object

	// make sure we can handle this DataFlavor
	if (ourDataFlavor.equals(df))
	    return getContent(ds);
	else
	    return null;
    
public java.awt.datatransfer.DataFlavor[]getTransferDataFlavors()
return the DataFlavors for this DataContentHandler

return
The DataFlavors.


                  
       
	return new DataFlavor[] { ourDataFlavor };
    
public voidwriteTo(java.lang.Object obj, java.lang.String mimeType, java.io.OutputStream os)

	// if the object is a DeliveryStatus, we know how to write that out
	if (obj instanceof DeliveryStatus) {
	    DeliveryStatus ds = (DeliveryStatus)obj;
	    try {
		ds.writeTo(os);
	    } catch (MessagingException me) {
		throw new IOException(me.toString());
	    }
	    
	} else {
	    throw new IOException("unsupported object");
	}