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