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

java.lang.Object
  extended byorg.apache.james.transport.mailets.listservcommands.MailDataSource
All Implemented Interfaces:
DataSource

public class MailDataSource
extends Object
implements 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 03:51:21 -0500 (Tue, 03 Jan 2006) $

Field Summary
protected  String contentType
           
protected  byte[] data
           
protected static int DEFAULT_BUF_SIZE
           
protected static String DEFAULT_ENCODING
           
protected static String DEFAULT_NAME
           
 
Constructor Summary
MailDataSource(byte[] data, String contentType)
          Create a datasource from a byte array
MailDataSource(InputStream inputStream, String contentType)
          Create a datasource from an input stream
MailDataSource(String data, String contentType)
          Create a datasource from a String
 
Method Summary
protected static int copyStream(InputStream inputStream, OutputStream outputStream)
           
 String getContentType()
          returns the contentType for this data source
 InputStream getInputStream()
          returns the inputStream
 String getName()
          returns a static moniker
 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 String DEFAULT_ENCODING
See Also:
Constant Field Values

DEFAULT_NAME

protected static final String DEFAULT_NAME
See Also:
Constant Field Values

data

protected byte[] data

contentType

protected String contentType
Constructor Detail

MailDataSource

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


MailDataSource

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


MailDataSource

public MailDataSource(String data,
                      String contentType)
               throws UnsupportedEncodingException
Create a datasource from a String

Method Detail

getInputStream

public InputStream getInputStream()
                           throws IOException
returns the inputStream

Specified by:
getInputStream in interface DataSource
Throws:
IOException

getOutputStream

public OutputStream getOutputStream()
                             throws IOException
Not implemented

Specified by:
getOutputStream in interface DataSource
Throws:
IOException

getContentType

public String getContentType()
returns the contentType for this data source

Specified by:
getContentType in interface DataSource

getName

public String getName()
returns a static moniker

Specified by:
getName in interface DataSource

copyStream

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


"Copyright © 1999-2006 Apache Jakarta Project. All Rights Reserved."