Package org.compiere.util
Class ByteArrayDataSource
- java.lang.Object
-
- org.compiere.util.ByteArrayDataSource
-
- All Implemented Interfaces:
javax.activation.DataSource
public class ByteArrayDataSource extends Object implements javax.activation.DataSource
A DataSource based on the Java Mail Example. 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)
Create a DataSource from a byte arrayByteArrayDataSource(InputStream is, String type)
Create a DataSource from an input streamByteArrayDataSource(String stringData, String charSetName, String type)
Create a DataSource from a String
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getContentType()
Get Content TypeInputStream
getInputStream()
Return an InputStream for the data.String
getName()
Return Name or Class Name and Content TypeOutputStream
getOutputStream()
Throws exceptionByteArrayDataSource
setName(String name)
Set Name
-
-
-
Constructor Detail
-
ByteArrayDataSource
public ByteArrayDataSource(InputStream is, String type)
Create a DataSource from an input stream- Parameters:
is
- streamtype
- optional MIME type e.g. text/html
-
ByteArrayDataSource
public ByteArrayDataSource(byte[] data, String type)
Create a DataSource from a byte array- Parameters:
data
- datatype
- type e.g. text/html
-
-
Method Detail
-
getInputStream
public InputStream getInputStream() throws IOException
Return an InputStream for the data.- Specified by:
getInputStream
in interfacejavax.activation.DataSource
- Returns:
- inputstream
- Throws:
IOException
-
getOutputStream
public OutputStream getOutputStream() throws IOException
Throws exception- Specified by:
getOutputStream
in interfacejavax.activation.DataSource
- Returns:
- null
- Throws:
IOException
-
getContentType
public String getContentType()
Get Content Type- Specified by:
getContentType
in interfacejavax.activation.DataSource
- Returns:
- MIME type e.g. text/html
-
setName
public ByteArrayDataSource setName(String name)
Set Name- Parameters:
name
- name- Returns:
- this
-
getName
public String getName()
Return Name or Class Name and Content Type- Specified by:
getName
in interfacejavax.activation.DataSource
- Returns:
- dummy
-
-