Compoze Software, Inc.

com.compoze.util
Class StringDataSource

java.lang.Object
  |
  +--com.compoze.util.StringDataSource
All Implemented Interfaces:
javax.activation.DataSource

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

This class implements a data source for strings.


Constructor Summary
StringDataSource(java.lang.String sData, java.lang.String sAttachmentName)
          Constructor.
StringDataSource(java.lang.String sData, java.lang.String sContentType, java.lang.String sAttachmentName)
          Constructor.
StringDataSource(java.lang.String sData, java.lang.String sContentType, java.lang.String sCharacterEncoding, java.lang.String sAttachmentName)
          Constructor.
 
Method Summary
 java.lang.String getContentType()
          Get the content-type of the data.
 java.io.InputStream getInputStream()
          Get an input stream to the data.
 java.lang.String getName()
          Get the name of the attachment.
 java.io.OutputStream getOutputStream()
          Get an output stream to the data (not supported).
 void setContentType(java.lang.String sContentType)
          Set the content-type of the data.
 void setName(java.lang.String sName)
          Set the name of the attachment.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringDataSource

public StringDataSource(java.lang.String sData,
                        java.lang.String sAttachmentName)
Constructor. The content-type defaults to text/plain.
Parameters:
sData - the string
sAttachmentName - the attachment name

StringDataSource

public StringDataSource(java.lang.String sData,
                        java.lang.String sContentType,
                        java.lang.String sAttachmentName)
Constructor.
Parameters:
sData - the string
sContentType - the content-type
sAttachmentName - the attachment name

StringDataSource

public StringDataSource(java.lang.String sData,
                        java.lang.String sContentType,
                        java.lang.String sCharacterEncoding,
                        java.lang.String sAttachmentName)
Constructor.
Parameters:
sData - the string
sContentType - the content-type
sCharacterEncoding - the character encoding
sAttachmentName - the attachment name
Method Detail

getContentType

public java.lang.String getContentType()
Get the content-type of the data.
Specified by:
getContentType in interface javax.activation.DataSource
Returns:
the content-type of the data

setContentType

public void setContentType(java.lang.String sContentType)
Set the content-type of the data.
Parameters:
sContentType - the content-type of the data

getName

public java.lang.String getName()
Get the name of the attachment.
Specified by:
getName in interface javax.activation.DataSource
Returns:
the name of the attachment

setName

public void setName(java.lang.String sName)
Set the name of the attachment.
Parameters:
sName - the name of the attachment

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.UnsupportedEncodingException
Get an input stream to the data.
Specified by:
getInputStream in interface javax.activation.DataSource
Returns:
an input stream to the data

getOutputStream

public java.io.OutputStream getOutputStream()
                                     throws java.io.IOException
Get an output stream to the data (not supported).
Specified by:
getOutputStream in interface javax.activation.DataSource
Returns:
the output stream to the data
Throws:
java.io.IOException - always thrown because operation not supported

Compoze Software, Inc.

Copyright ©1999-2003 Compoze Software, Inc. All rights reserved.