public class ByteArrayDataSource extends java.lang.Object implements SizeAwareDataSource
| Modifier and Type | Field and Description |
|---|---|
private byte[] |
data |
private java.lang.String |
type |
| Constructor and Description |
|---|
ByteArrayDataSource(byte[] data) |
ByteArrayDataSource(byte[] data,
java.lang.String type) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getContentType() |
java.io.InputStream |
getInputStream() |
java.lang.String |
getName() |
java.io.OutputStream |
getOutputStream() |
long |
getSize()
Get the size of the data source.
|
void |
setType(java.lang.String type) |
public ByteArrayDataSource(byte[] data,
java.lang.String type)
public ByteArrayDataSource(byte[] data)
public void setType(java.lang.String type)
public java.lang.String getContentType()
getContentType in interface javax.activation.DataSourcepublic java.io.InputStream getInputStream()
throws java.io.IOException
getInputStream in interface javax.activation.DataSourcejava.io.IOExceptionpublic java.lang.String getName()
getName in interface javax.activation.DataSourcepublic java.io.OutputStream getOutputStream()
throws java.io.IOException
getOutputStream in interface javax.activation.DataSourcejava.io.IOExceptionpublic long getSize()
SizeAwareDataSourceDataSource.getInputStream() before reaching
the end of the stream. If the implementation is unable to determine the
size, it must return -1.getSize in interface SizeAwareDataSource