Package org.apache.commons.mail
Class ByteArrayDataSource
java.lang.Object
org.apache.commons.mail.ByteArrayDataSource
- All Implemented Interfaces:
DataSource
Deprecated.
A typed DataSource for InputStream, byte array, and String.
From version 1.3.1, it is possible to set a name for this DataSource, and it is recommended to do so.
- Since:
- 1.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Deprecated.Define the buffer size. -
Constructor Summary
ConstructorsConstructorDescriptionByteArrayDataSource
(byte[] data, String contentType) Deprecated.Constructs a new instance from a byte array.ByteArrayDataSource
(InputStream inputStream, String contentType) Deprecated.Constructs a new instance from an input stream.ByteArrayDataSource
(String data, String contentType) Deprecated.Constructs a new instance from a String. -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.Gets the content contentType.Deprecated.Gets the input stream.getName()
Deprecated.Gets the name.Deprecated.Gets the OutputStream to write to.void
Deprecated.Sets the name for this DataSource.
-
Field Details
-
BUFFER_SIZE
Deprecated.Define the buffer size.- See Also:
-
-
Constructor Details
-
ByteArrayDataSource
Deprecated.Constructs a new instance from a byte array.- Parameters:
data
- A byte[].contentType
- A String.- Throws:
IOException
- IOException- Since:
- 1.0
-
ByteArrayDataSource
Deprecated.Constructs a new instance from an input stream.- Parameters:
inputStream
- An InputStream.contentType
- A String.- Throws:
IOException
- IOException- Since:
- 1.0
-
ByteArrayDataSource
Deprecated.Constructs a new instance from a String. N.B. assumes the data string can be converted using the charset iso-8859-1.- Parameters:
data
- A String.contentType
- A String.- Throws:
IOException
- IOException- Since:
- 1.0
-
-
Method Details
-
getContentType
Deprecated.Gets the content contentType.- Specified by:
getContentType
in interfaceDataSource
- Returns:
- A String.
- Since:
- 1.0
-
getInputStream
Deprecated.Gets the input stream.- Specified by:
getInputStream
in interfaceDataSource
- Returns:
- An InputStream.
- Throws:
IOException
- IOException- Since:
- 1.0
-
getName
Deprecated.Gets the name.- Specified by:
getName
in interfaceDataSource
- Returns:
- A String.
- Since:
- 1.0
-
getOutputStream
Deprecated.Gets the OutputStream to write to.- Specified by:
getOutputStream
in interfaceDataSource
- Returns:
- An OutputStream
- Since:
- 1.0
-
setName
Deprecated.Sets the name for this DataSource.- Parameters:
name
- The name.- Since:
- 1.3.1
-
ByteArrayDataSource
orSharedByteArrayInputStream
.