Holger's
Java API

com.antelmann.net.mail
Class Email.Attachment

java.lang.Object
  extended by com.antelmann.net.mail.Email.Attachment
All Implemented Interfaces:
Serializable, javax.activation.DataSource
Enclosing class:
Email

public static class Email.Attachment
extends Object
implements Serializable, javax.activation.DataSource

Attachment represents an attachment to an email. Attachment requires the javax.activation package if the method getContentType() is called and the type has not been explicitly set before.

See Also:
Serialized Form

Constructor Summary
Email.Attachment(String fileName, byte[] content, String type)
           
 
Method Summary
 byte[] getContent()
           
 String getContentType()
          if the content has not been explicitly set (or if the attachment was instanciated through a File object), this method call requires the javax.activation package.
 InputStream getInputStream()
           
 String getName()
           
 OutputStream getOutputStream()
          always throws IOException; functionality not supported
 MyFile saveToDir(File dir)
          the name of the attachment will be used as the file name
 void saveToFile(File file)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Email.Attachment

public Email.Attachment(String fileName,
                        byte[] content,
                        String type)
Method Detail

getName

public String getName()
Specified by:
getName in interface javax.activation.DataSource

getContent

public byte[] getContent()

getContentType

public String getContentType()
if the content has not been explicitly set (or if the attachment was instanciated through a File object), this method call requires the javax.activation package.

Specified by:
getContentType in interface javax.activation.DataSource

getOutputStream

public OutputStream getOutputStream()
                             throws IOException
always throws IOException; functionality not supported

Specified by:
getOutputStream in interface javax.activation.DataSource
Throws:
IOException

getInputStream

public InputStream getInputStream()
                           throws IOException
Specified by:
getInputStream in interface javax.activation.DataSource
Throws:
IOException

saveToDir

public MyFile saveToDir(File dir)
                 throws IOException
the name of the attachment will be used as the file name

Throws:
IOException

saveToFile

public void saveToFile(File file)
                throws IOException
Throws:
IOException


(c) 2001-2006 Holger Antelmann - all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads