org.apache.taglibs.mailer2
Class ByteArrayDataSource

java.lang.Object
  extended byorg.apache.taglibs.mailer2.ByteArrayDataSource
All Implemented Interfaces:
DataSource

public class ByteArrayDataSource
extends Object
implements DataSource

Implements a javax.activation.DataSource for byte array content. Used for attachments with unknown types (unlike text/plain, text/html or text/xml) that are created with the mt:attach with explicit name and type attributes and body content.

Version:
2.0
Author:
Jeroen van Vianen

Constructor Summary
ByteArrayDataSource(byte[] content, String name, String contentType)
          Constructor.
 
Method Summary
 String getContentType()
          Returns the Content-Type of the DataSource.
 InputStream getInputStream()
          Returns an InputStream to the byte array content.
 String getName()
          Returns the name of the DataSource.
 OutputStream getOutputStream()
          Returns an OutputStream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteArrayDataSource

public ByteArrayDataSource(byte[] content,
                           String name,
                           String contentType)
Constructor.

Parameters:
content - Byte array with content
name - Name of the attachment
contentType - Content-Type of the datasource
Method Detail

getInputStream

public InputStream getInputStream()
Returns an InputStream to the byte array content.

Specified by:
getInputStream in interface DataSource
Returns:
An InputStream

getOutputStream

public OutputStream getOutputStream()
Returns an OutputStream.

Specified by:
getOutputStream in interface DataSource
Returns:
An OutputStream

getContentType

public String getContentType()
Returns the Content-Type of the DataSource.

Specified by:
getContentType in interface DataSource
Returns:
The Content-Type

getName

public String getName()
Returns the name of the DataSource.

Specified by:
getName in interface DataSource
Returns:
The name


Copyright © 2004 Apache Software Foundation, http://jakarta.apache.org/taglibs