org.apache.james.transport.mailets.listservcommands
Class MailDataSource

java.lang.Object
  extended by org.apache.james.transport.mailets.listservcommands.MailDataSource
All Implemented Interfaces:
javax.activation.DataSource

public class MailDataSource
extends java.lang.Object
implements javax.activation.DataSource

MailDataSource implements a typed DataSource from : an InputStream, a byte array, and a string This is used from BaseCommand.generateMail(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)

Since:
2.2.0
Version:
CVS $Revision: 365582 $ $Date: 2006-01-03 08:51:21 +0000 (mar, 03 gen 2006) $

Field Summary
protected  java.lang.String contentType
           
protected  byte[] data
           
protected static int DEFAULT_BUF_SIZE
           
protected static java.lang.String DEFAULT_ENCODING
           
protected static java.lang.String DEFAULT_NAME
           
 
Constructor Summary
MailDataSource(byte[] data, java.lang.String contentType)
          Create a datasource from a byte array
MailDataSource(java.io.InputStream inputStream, java.lang.String contentType)
          Create a datasource from an input stream
MailDataSource(java.lang.String data, java.lang.String contentType)
          Create a datasource from a String
 
Method Summary
protected static int copyStream(java.io.InputStream inputStream, java.io.OutputStream outputStream)
           
 java.lang.String getContentType()
          returns the contentType for this data source
 java.io.InputStream getInputStream()
          returns the inputStream
 java.lang.String getName()
          returns a static moniker
 java.io.OutputStream getOutputStream()
          Not implemented
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_BUF_SIZE

protected static final int DEFAULT_BUF_SIZE
See Also:
Constant Field Values

DEFAULT_ENCODING

protected static final java.lang.String DEFAULT_ENCODING
See Also:
Constant Field Values

DEFAULT_NAME

protected static final java.lang.String DEFAULT_NAME
See Also:
Constant Field Values

data

protected byte[] data

contentType

protected java.lang.String contentType
Constructor Detail

MailDataSource

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

Throws:
java.io.IOException

MailDataSource

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


MailDataSource

public MailDataSource(java.lang.String data,
                      java.lang.String contentType)
               throws java.io.UnsupportedEncodingException
Create a datasource from a String

Throws:
java.io.UnsupportedEncodingException
Method Detail

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
returns the inputStream

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()
returns the contentType for this data source

Specified by:
getContentType in interface javax.activation.DataSource

getName

public java.lang.String getName()
returns a static moniker

Specified by:
getName in interface javax.activation.DataSource

copyStream

protected static int copyStream(java.io.InputStream inputStream,
                                java.io.OutputStream outputStream)
                         throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2002-2007 The Apache Software Foundation. All Rights Reserved.