com.novell.nds.dirxml.util.mail
Class ByteArrayDataSource

java.lang.Object
  extended bycom.novell.nds.dirxml.util.mail.ByteArrayDataSource
All Implemented Interfaces:
javax.activation.DataSource

public class ByteArrayDataSource
extends Object
implements javax.activation.DataSource

Implement DataSource interface for an array of bytes so that we can use this to set the data in a MimeBodyPart.


Constructor Summary
ByteArrayDataSource(byte[] data, String mimeType)
          Create the DataSource.
 
Method Summary
 String getContentType()
          Return the content type of this data.
 InputStream getInputStream()
          Return an InputStream for the data.
 String getName()
          Return empty string.
 OutputStream getOutputStream()
          Return an OutputStream for the data to be written.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteArrayDataSource

public ByteArrayDataSource(byte[] data,
                           String mimeType)
Create the DataSource.

Parameters:
data - The data (duh)
mimeType - The mime type of the data (text/html, application/octet-stream, etc.)
Method Detail

getInputStream

public InputStream getInputStream()
                           throws IOException
Return an InputStream for the data.

Specified by:
getInputStream in interface javax.activation.DataSource
Returns:
The InputStream
Throws:
IOException

getOutputStream

public OutputStream getOutputStream()
                             throws IOException
Return an OutputStream for the data to be written.

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

getContentType

public String getContentType()
Return the content type of this data.

Specified by:
getContentType in interface javax.activation.DataSource
Returns:
mime type string

getName

public String getName()
Return empty string.

Specified by:
getName in interface javax.activation.DataSource