Package com.spun.util
Class ByteArrayDataSource
java.lang.Object
com.spun.util.ByteArrayDataSource
- All Implemented Interfaces:
DataSource
public class ByteArrayDataSource extends Object implements DataSource
Comment By LLewellyn: This is a needed class for using mail. For some reason wasn't
made as part of the standard mail package.
A simple DataSource for demonstration purposes. This class implements a DataSource from: an InputStream a byte array a String
- Author:
- John Mani, Bill Shannon, Max Spivak
-
Constructor Summary
Constructors Constructor Description ByteArrayDataSource(byte[] data, String type)ByteArrayDataSource(InputStream is, String type)ByteArrayDataSource(InputStream is, String type, String name)ByteArrayDataSource(String data, String type)ByteArrayDataSource(String data, String type, String name) -
Method Summary
Modifier and Type Method Description StringgetContentType()InputStreamgetInputStream()Return an InputStream for the data.StringgetName()OutputStreamgetOutputStream()voidsetName(String name)
-
Constructor Details
-
ByteArrayDataSource
-
ByteArrayDataSource
-
ByteArrayDataSource
-
ByteArrayDataSource
-
ByteArrayDataSource
-
-
Method Details
-
setName
-
getInputStream
Return an InputStream for the data. Note - a new stream must be returned each time.- Specified by:
getInputStreamin interfaceDataSource- Throws:
IOException
-
getOutputStream
- Specified by:
getOutputStreamin interfaceDataSource- Throws:
IOException
-
getContentType
- Specified by:
getContentTypein interfaceDataSource
-
getName
- Specified by:
getNamein interfaceDataSource
-