Package com.priint.pubserver.util
Class ByteArrayDataSource
- java.lang.Object
-
- com.priint.pubserver.util.ByteArrayDataSource
-
- All Implemented Interfaces:
javax.activation.DataSource
public class ByteArrayDataSource extends java.lang.Object implements javax.activation.DataSourceClass responsible for ByteArrayDataSource
-
-
Constructor Summary
Constructors Constructor Description ByteArrayDataSource()default empty constructorByteArrayDataSource(byte[] data)constructor.ByteArrayDataSource(java.lang.String contentType, java.lang.String name, byte[] data)constructorByteArrayDataSource(java.lang.String contentType, java.lang.String name, java.lang.String data)constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetContentType()byte[]getData()java.io.InputStreamgetInputStream()java.lang.StringgetName()java.io.OutputStreamgetOutputStream()voidsetContentType(java.lang.String contentType)set the content type of the ByteArrayDataSourcevoidsetData(byte[] data)set the data for the ByteArrayDataSourcevoidsetName(java.lang.String name)set the name for the ByteArrayDataSource
-
-
-
Constructor Detail
-
ByteArrayDataSource
public ByteArrayDataSource()
default empty constructor
-
ByteArrayDataSource
public ByteArrayDataSource(java.lang.String contentType, java.lang.String name, byte[] data)constructor- Parameters:
contentType- type of content to be createdname- name of the ByteArrayDataSource to be createddata- data provided as byte[]
-
ByteArrayDataSource
public ByteArrayDataSource(java.lang.String contentType, java.lang.String name, java.lang.String data)constructor- Parameters:
contentType- type of content to be createdname- name of the ByteArrayDataSource to be createddata- data provided as String
-
ByteArrayDataSource
public ByteArrayDataSource(byte[] data)
constructor. Content type is automatically set to "application/text". Name is set to "String"- Parameters:
data- data provided as byte[] to be included.
-
-
Method Detail
-
getInputStream
public java.io.InputStream getInputStream() throws java.io.IOException- Specified by:
getInputStreamin interfacejavax.activation.DataSource- Returns:
- ByteArrayInputStream
- Throws:
java.io.IOException
-
getOutputStream
public java.io.OutputStream getOutputStream() throws java.io.IOException- Specified by:
getOutputStreamin interfacejavax.activation.DataSource- Returns:
- ByteArrayOutputStream
- Throws:
java.io.IOException
-
getData
public byte[] getData()
- Returns:
- data as byte[]
-
setData
public void setData(byte[] data)
set the data for the ByteArrayDataSource- Parameters:
data- as byte[]
-
getName
public java.lang.String getName()
- Specified by:
getNamein interfacejavax.activation.DataSource- Returns:
- name as String
-
setName
public void setName(java.lang.String name)
set the name for the ByteArrayDataSource- Parameters:
name- as String
-
getContentType
public java.lang.String getContentType()
- Specified by:
getContentTypein interfacejavax.activation.DataSource- Returns:
- content type as String
-
setContentType
public void setContentType(java.lang.String contentType)
set the content type of the ByteArrayDataSource- Parameters:
contentType- as String
-
-