public class StringDataSource
extends java.lang.Object
implements javax.activation.DataSource
| Constructor and Description |
|---|
StringDataSource(java.lang.String s,
java.lang.String mimeType,
java.lang.String name)
Create a new StringDataSource object.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getContentType()
Get the content type (i.e., the MIME type) associated with the
underlying string's content.
|
java.io.InputStream |
getInputStream()
Get a new InputStream object that will read from this
object's string buffer.
|
java.lang.String |
getName()
Get the name associated with the underlying string's content.
|
java.io.OutputStream |
getOutputStream()
According to the documentation for the DataSource
interface, this method returns an OutputStream where the data can be
written and throws the appropriate exception if it can not do so.
|
public StringDataSource(java.lang.String s,
java.lang.String mimeType,
java.lang.String name)
s - The string from which to readmimeType - The MIME type (or content type) to associate with
the contents of the string. If this parameter is
null, it defaults to "application/octet-stream".name - The name to associate with the content. For an
email attachment, this parameter is typically used
to name the attachment. If this parameter is
null, a name will be generated.public java.io.InputStream getInputStream()
throws java.io.IOException
getInputStream in interface javax.activation.DataSourcejava.io.IOException - On error.public java.io.OutputStream getOutputStream()
throws java.io.IOException
getOutputStream in interface javax.activation.DataSourcejava.io.IOException - Always.public java.lang.String getContentType()
getContentType in interface javax.activation.DataSourcepublic java.lang.String getName()
getName in interface javax.activation.DataSource