Package com.priint.pubserver.util
Class ByteArrayDataSource
java.lang.Object
com.priint.pubserver.util.ByteArrayDataSource
- All Implemented Interfaces:
jakarta.activation.DataSource
Class responsible for ByteArrayDataSource
-
Constructor Summary
ConstructorsConstructorDescriptiondefault empty constructorByteArrayDataSource(byte[] data) constructor.ByteArrayDataSource(String contentType, String name, byte[] data) constructorByteArrayDataSource(String contentType, String name, String data) constructor -
Method Summary
Modifier and TypeMethodDescriptionbyte[]getData()getName()voidsetContentType(String contentType) set the content type of the ByteArrayDataSourcevoidsetData(byte[] data) set the data for the ByteArrayDataSourcevoidset the name for the ByteArrayDataSource
-
Constructor Details
-
ByteArrayDataSource
public ByteArrayDataSource()default empty constructor -
ByteArrayDataSource
constructor- Parameters:
contentType- type of content to be createdname- name of the ByteArrayDataSource to be createddata- data provided as byte[]
-
ByteArrayDataSource
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 Details
-
getInputStream
- Specified by:
getInputStreamin interfacejakarta.activation.DataSource- Returns:
- ByteArrayInputStream
- Throws:
IOException
-
getOutputStream
- Specified by:
getOutputStreamin interfacejakarta.activation.DataSource- Returns:
- ByteArrayOutputStream
- Throws:
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
- Specified by:
getNamein interfacejakarta.activation.DataSource- Returns:
- name as String
-
setName
set the name for the ByteArrayDataSource- Parameters:
name- as String
-
getContentType
- Specified by:
getContentTypein interfacejakarta.activation.DataSource- Returns:
- content type as String
-
setContentType
set the content type of the ByteArrayDataSource- Parameters:
contentType- as String
-