| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public class ByteArrayDataSource extends Object implements DataSource
A DataSource backed by a byte array. The byte array may be passed in directly, or may be initialized from an InputStream or a String.
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
String |
Get the MIME content type of the data. |
InputStream |
Return an InputStream for the data. |
String |
getName() Get the name of the data. |
OutputStream |
Return an OutputStream for the data. |
void |
Set the name of the data. |
Constructor Detail |
---|
public ByteArrayDataSource(byte[] data, String type)
data
- the datatype
- the MIME typepublic ByteArrayDataSource(InputStream is, String type) throws IOException
is
- the InputStreamtype
- the MIME typeIOException
- errors reading the streampublic 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 StringMethod Detail |
---|
public String getContentType()
public InputStream getInputStream() throws IOException
IOException
- if no data has been setpublic String getName()
public OutputStream getOutputStream() throws IOException
IOException
is always thrown.
IOException
- alwayspublic void setName(String name)
name
- the name of this data
| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |