public class ByteArrayDataSource
extends java.lang.Object
implements javax.activation.DataSource
Constructor and Description |
---|
ByteArrayDataSource(byte[] data,
java.lang.String type)
Create a ByteArrayDataSource directly from a byte array.
|
ByteArrayDataSource(java.io.InputStream in,
java.lang.String type)
Create a ByteArrayDataSource from an input stream.
|
ByteArrayDataSource(java.lang.String data,
java.lang.String type)
Create a ByteArrayDataSource from a string value.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getContentType()
Get the MIME content type information for this DataSource.
|
java.io.InputStream |
getInputStream()
Create an input stream for this data.
|
java.lang.String |
getName()
Retrieve the DataSource name.
|
java.io.OutputStream |
getOutputStream()
Open an output stream for the DataSource.
|
void |
setName(java.lang.String name)
Set a new DataSource name.
|
public ByteArrayDataSource(java.io.InputStream in, java.lang.String type) throws java.io.IOException
in
- The source input stream.type
- The MIME-type of the data.java.io.IOException
public ByteArrayDataSource(byte[] data, java.lang.String type)
data
- The source byte array (not copied).type
- The content MIME-type.public ByteArrayDataSource(java.lang.String data, java.lang.String type) throws java.io.IOException
data
- The source data string.type
- The MIME type information.java.io.IOException
public java.io.InputStream getInputStream() throws java.io.IOException
getInputStream
in interface javax.activation.DataSource
java.io.IOException
public java.io.OutputStream getOutputStream() throws java.io.IOException
getOutputStream
in interface javax.activation.DataSource
java.io.IOException
public java.lang.String getContentType()
getContentType
in interface javax.activation.DataSource
public java.lang.String getName()
getName
in interface javax.activation.DataSource
public void setName(java.lang.String name)
name
- The new name.