com.openexchange.mail.mime.datasource
Class MessageDataSource

java.lang.Object
  extended by com.openexchange.mail.mime.datasource.MessageDataSource
All Implemented Interfaces:
javax.activation.DataSource

public final class MessageDataSource
extends java.lang.Object
implements javax.activation.DataSource

MessageDataSource - Allows creation of a data source by either an input stream, a string or a byte array.

Author:
Thorben Betten

Constructor Summary
MessageDataSource(byte[] data, java.lang.String contentType)
          Create a data source from a byte array
MessageDataSource(java.io.InputStream inputStream, ContentType contentType)
          Create a data source from an input stream
MessageDataSource(java.io.InputStream inputStream, ContentType contentType, java.lang.String name)
          Create a data source from an input stream
MessageDataSource(java.io.InputStream inputStream, java.lang.String contentType)
          Create a data source from an input stream
MessageDataSource(java.io.InputStream inputStream, java.lang.String contentType, java.lang.String name)
          Create a data source from an input stream
MessageDataSource(java.lang.String data, ContentType contentType)
          Create a data source from a String
MessageDataSource(java.lang.String data, java.lang.String contentType)
          Create a data source from a String
 
Method Summary
 java.lang.String getContentType()
           
 java.io.InputStream getInputStream()
           
 java.lang.String getName()
           
 java.io.OutputStream getOutputStream()
          Not implemented
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageDataSource

public MessageDataSource(java.io.InputStream inputStream,
                         java.lang.String contentType)
                  throws java.io.IOException
Create a data source from an input stream

Throws:
java.io.IOException

MessageDataSource

public MessageDataSource(java.io.InputStream inputStream,
                         ContentType contentType)
                  throws java.io.IOException
Create a data source from an input stream

Throws:
java.io.IOException

MessageDataSource

public MessageDataSource(java.io.InputStream inputStream,
                         java.lang.String contentType,
                         java.lang.String name)
                  throws java.io.IOException
Create a data source from an input stream

Throws:
java.io.IOException

MessageDataSource

public MessageDataSource(java.io.InputStream inputStream,
                         ContentType contentType,
                         java.lang.String name)
                  throws java.io.IOException
Create a data source from an input stream

Throws:
java.io.IOException

MessageDataSource

public MessageDataSource(byte[] data,
                         java.lang.String contentType)
Create a data source from a byte array


MessageDataSource

public MessageDataSource(java.lang.String data,
                         java.lang.String contentType)
                  throws java.io.UnsupportedEncodingException,
                         MailException
Create a data source from a String

Throws:
java.io.UnsupportedEncodingException
MailException

MessageDataSource

public MessageDataSource(java.lang.String data,
                         ContentType contentType)
                  throws java.io.UnsupportedEncodingException
Create a data source from a String

Throws:
java.io.UnsupportedEncodingException
Method Detail

getInputStream

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

getOutputStream

public java.io.OutputStream getOutputStream()
                                     throws java.io.IOException
Not implemented

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

getContentType

public java.lang.String getContentType()
Specified by:
getContentType in interface javax.activation.DataSource

getName

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