AttachmentDataSource¶
-
public class
AttachmentDataSource
implements DataSource¶ This is an implementation of
javax.activation.DataSource
that encapsulates attachment data in a SOAP message.Author: cyng
Constructors¶
AttachmentDataSource¶
AttachmentDataSource¶
-
public
AttachmentDataSource
(byte[] data, String contentType, String name)¶ Constructs an
AttachmentDataSource
object from an array of binary data, and assign a name to the data source.Parameters: - data – Byte array containing data for the
AttachmentDataSource
- contentType – Content type of the data.
- name – Name assigned to the
AttachmentDataSource
- data – Byte array containing data for the
AttachmentDataSource¶
-
public
AttachmentDataSource
(byte[] data, String contentType, String encoding, String name)¶ Constructs an
AttachmentDataSource
object from an array of binary data, and assign a name to the data source.Parameters: - data – Byte array containing data for the
AttachmentDataSource
- contentType – Content type of the data.
- encoding – Content-Transfer-Encoding of the data.
- name – Name assigned to the
AttachmentDataSource
- data – Byte array containing data for the
AttachmentDataSource¶
AttachmentDataSource¶
-
public
AttachmentDataSource
(String fileName, String contentType, boolean loadToMem)¶ Constructs an
AttachmentDataSource
object from a file.Parameters: - fileName – Name of the file to be loaded.
- contentType – Content type of the file.
- loadToMem – Load all data to memory upon creation
Throws: - IOException –
AttachmentDataSource¶
AttachmentDataSource¶
-
public
AttachmentDataSource
(File file, String contentType, boolean loadToMem)¶ Constructs an
AttachmentDataSource
object from aFile
object.Parameters: - file –
File
object containing information on the file to be loaded. - contentType – Content type of the file.
- loadToMem – Load all data to memory upon creation
Throws: - IOException –
- file –
AttachmentDataSource¶
-
public
AttachmentDataSource
(InputStream in, String contentType)¶ Constructs an
AttachmentDataSource
object from anInputStream
.Parameters: - in –
InputStream
from which the data is read and stored in the data source. - contentType – Content type of the data.
Throws: - IOException –
- in –
AttachmentDataSource¶
-
public
AttachmentDataSource
(InputStream in, String contentType, String name)¶ Constructs an
AttachmentDataSource
object from anInputStream
with a given name.Parameters: - in –
InputStream
from which the data is read and stored in the data source. - contentType – Content type of the data.
- name – Name assigned to the
AttachmentDataSource
.
Throws: - IOException –
- in –
AttachmentDataSource¶
-
public
AttachmentDataSource
(InputStream in, String contentType, String encoding, String name)¶ Constructs an
AttachmentDataSource
object from anInputStream
with the specified Content-Transfer-Encoding and name.Parameters: - in –
InputStream
from which the data is read and stored in the data source. - contentType – Content type of the data.
- encoding – Content-Transfer-Encoding of the data.
- name – Name assigned to the
AttachmentDataSource
.
Throws: - IOException –
- in –
AttachmentDataSource¶
-
public
AttachmentDataSource
(String fileName, long offset, long length, String contentType)¶ Constructs an
AttachmentDataSource
object using the data oflength
in a file starting fromoffset
with the specified Content-Type.Parameters: - fileName – Name of the file to be loaded.
- offset – Offset from the start of the file.
- length – Length of data to be read.
- contentType – Content type of the data.
AttachmentDataSource¶
-
public
AttachmentDataSource
(String fileName, long offset, long length, String contentType, boolean loadToMem)¶ Constructs an
AttachmentDataSource
object using the data oflength
in a file starting fromoffset
with the specified Content-Type.Parameters: - fileName – Name of the file to be loaded.
- offset – Offset from the start of the file.
- length – Length of data to be read.
- contentType – Content type of the data.
- loadToMem – Load all data to memory upon creation
AttachmentDataSource¶
-
public
AttachmentDataSource
(String fileName, long offset, long length, String contentType, String encoding)¶ Constructs an
AttachmentDataSource
object using the data oflength
in a file starting fromoffset
. with the specified Content-Type and Content-Transfer-Encoding.Parameters: - fileName – Name of the file to be loaded.
- offset – Offset from the start of the file.
- length – Length of data to be read.
- contentType – Content type of the data.
- encoding – Content-Transfer-Encoding of the data.
AttachmentDataSource¶
-
public
AttachmentDataSource
(String fileName, long offset, long length, String contentType, String encoding, boolean loadToMem)¶ Constructs an
AttachmentDataSource
object using the data oflength
in a file starting fromoffset
. with the specified Content-Type and Content-Transfer-Encoding.Parameters: - fileName – Name of the file to be loaded.
- offset – Offset from the start of the file.
- length – Length of data to be read.
- contentType – Content type of the data.
- encoding – Content-Transfer-Encoding of the data.
- loadToMem – Load all data to memory upon creation
AttachmentDataSource¶
-
public
AttachmentDataSource
(DataSource dataSource, long offset, long length, String contentType, String encoding, boolean loadToMem)¶
Methods¶
getByteArray¶
-
public byte[]
getByteArray
()¶ Gets a byte array of data in this data source.
Returns: A byte array of data.
getContentType¶
getInputStream¶
-
public InputStream
getInputStream
()¶ Gets
InputStream
from which data in theAttachmentDataSource
can be read.Throws: - IOException –
Returns: An
InputStream
.
getLength¶
-
public long
getLength
()¶ Gets the length of data in this data source
Returns: length of data
getName¶
getOutputStream¶
-
public OutputStream
getOutputStream
()¶ This method should never be called. It implements the
getOutputStream()
method of thejavax.activation.DataSource
interface andIOException
will be thrown as the result of invocation.Throws: - IOException –
Returns: This method always result in
IOException
; it never returns normally.