public class ByteArrayDataSource extends Object implements DataSource
Constructor and Description |
---|
ByteArrayDataSource(byte[] data,
String type)
Create a ByteArrayDataSource with data from the
specified byte array and with the specified MIME type.
|
ByteArrayDataSource(InputStream is,
String type)
Create a ByteArrayDataSource with data from the
specified InputStream and with the specified MIME type.
|
ByteArrayDataSource(String data,
String type)
Create a ByteArrayDataSource with data from the
specified String and with the specified MIME type.
|
Modifier and Type | Method and Description |
---|---|
String |
getContentType()
Get the MIME content type of the data.
|
InputStream |
getInputStream()
Return an InputStream for the data.
|
String |
getName()
Get the name of the data.
|
OutputStream |
getOutputStream()
Return an OutputStream for the data.
|
void |
setName(String name)
Set the name of the data.
|
public ByteArrayDataSource(InputStream is, String type) throws IOException
is
- the InputStreamtype
- the MIME typeIOException
- errors reading the streampublic ByteArrayDataSource(byte[] data, String type)
data
- the datatype
- the MIME typepublic ByteArrayDataSource(String data, String type) throws IOException
charset
parameter specifying the charset to be used for the
string. If the parameter is not included, the
default charset is used.data
- the Stringtype
- the MIME typeIOException
- errors reading the Stringpublic InputStream getInputStream() throws IOException
getInputStream
in interface DataSource
IOException
- if no data has been setpublic OutputStream getOutputStream() throws IOException
IOException
is always thrown.getOutputStream
in interface DataSource
IOException
- alwayspublic String getContentType()
getContentType
in interface DataSource
public String getName()
getName
in interface DataSource
public void setName(String name)
name
- the name of this dataCopyright © 2016 JBoss by Red Hat. All rights reserved.