public class ByteArrayDataSource extends Object implements javax.activation.DataSource
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
|
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 javax.activation.DataSource
public InputStream getInputStream() throws IOException
getInputStream
in interface javax.activation.DataSource
IOException
- IOExceptionpublic String getName()
getName
in interface javax.activation.DataSource
public OutputStream getOutputStream()
getOutputStream
in interface javax.activation.DataSource
Copyright © 2001-2012 Apache Software Foundation. All Rights Reserved.