InputStreamDataSource

public class InputStreamDataSource implements DataSource

InputStreamDataSource is an implementation of the javax.activation.DataSource It is designed to be used by SOAPMailSender as a bridge of InputStream and OutputStream for base64 encoding transformation.

Author:Philip Wong

See also: hk.hku.cecid.piazza.commons.soap.SOAPMailSender

Constructors

InputStreamDataSource

public InputStreamDataSource(InputStream is, String contentType, String name)

Creates a new instance of InputStreamDataSource by BodyPart.

Parameters:
  • is – the input stream.
  • contentType – the content type.
  • name – the filename if any.

Methods

getContentType

public String getContentType()

Gets the content type.

Returns:the content type when this data source created.

getInputStream

public InputStream getInputStream()

Gets the input stream.

Returns:the input stream when this data source created.

getName

public String getName()

Gets the filename.

Returns:the content type when this data source created.

getOutputStream

public OutputStream getOutputStream()

Returns new byte array from a new BytesArrayOutStream always. Logically, it is required to copy binary content from the input stream to output stream. But it is found the same result without touching binary content.

Returns:the content type when this data source created.