wt.mail
Class ByteArrayDataSource

java.lang.Object
  extended bywt.mail.ByteArrayDataSource
All Implemented Interfaces:
javax.activation.DataSource

public class ByteArrayDataSource
extends Object
implements javax.activation.DataSource


Field Summary
private  byte[] data
           
private static String RESOURCE
           
private  String type
           
private static String versionID
           
 
Constructor Summary
ByteArrayDataSource(String data, String type)
          Create a datasource from a String assumed to be in the ISO-8859-15 charset.
ByteArrayDataSource(String data, String type, String charset)
          Create a datasource from a String.
 
Method Summary
 String getContentType()
           
 InputStream getInputStream()
           
 String getName()
           
 OutputStream getOutputStream()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

versionID

private static final String versionID
See Also:
Constant Field Values

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

data

private byte[] data

type

private String type
Constructor Detail

ByteArrayDataSource

public ByteArrayDataSource(String data,
                           String type,
                           String charset)
                    throws UnsupportedEncodingException
Create a datasource from a String.

Parameters:
data - The string containing the data
type - The content type of the string. Ex. "text/html".
charset - The charset the string uses.

ByteArrayDataSource

public ByteArrayDataSource(String data,
                           String type)
                    throws UnsupportedEncodingException
Create a datasource from a String assumed to be in the ISO-8859-15 charset.

Parameters:
data - The string containing the data
type - The content type of the string. Ex. "text/html".
Method Detail

getInputStream

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

getOutputStream

public OutputStream getOutputStream()
                             throws IOException
Specified by:
getOutputStream in interface javax.activation.DataSource
Throws:
IOException

getContentType

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

getName

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