public class ByteArrayDataSource extends Object implements DataSource
From version 1.3.1, it is possible to set a name for this DataSource, and it is recommended to do so.
| Modifier and Type | Field and Description |
|---|---|
static int |
BUFFER_SIZE
Define the buffer size.
|
| Constructor and Description |
|---|
ByteArrayDataSource(byte[] data,
String aType)
Create a datasource from a byte array.
|
ByteArrayDataSource(InputStream aIs,
String aType)
Create a datasource from an input stream.
|
ByteArrayDataSource(String data,
String aType)
Create a datasource from a String.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getContentType()
Get the content type.
|
InputStream |
getInputStream()
Get the input stream.
|
String |
getName()
Get the name.
|
OutputStream |
getOutputStream()
Get the OutputStream to write to.
|
void |
setName(String name)
Sets the name for this DataSource.
|
public static final int BUFFER_SIZE
public ByteArrayDataSource(byte[] data,
String aType)
throws IOException
data - A byte[].aType - A String.IOException - IOExceptionpublic ByteArrayDataSource(InputStream aIs, String aType) throws IOException
aIs - An InputStream.aType - A String.IOException - IOExceptionpublic ByteArrayDataSource(String data, String aType) throws IOException
data - A String.aType - A String.IOException - IOExceptionpublic String getContentType()
getContentType in interface DataSourcepublic InputStream getInputStream() throws IOException
getInputStream in interface DataSourceIOException - IOExceptionpublic void setName(String name)
name - The name.public String getName()
getName in interface DataSourcepublic OutputStream getOutputStream()
getOutputStream in interface DataSourceCopyright © 2001-2013 The Apache Software Foundation. All Rights Reserved.