Package org.apache.commons.mail
Class ByteArrayDataSource
java.lang.Object
org.apache.commons.mail.ByteArrayDataSource
- All Implemented Interfaces:
javax.activation.DataSource
Deprecated.
This class implements a typed DataSource from:
- an InputStream
- a byte array
- a String
- an InputStream
- a byte array
- a 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 aType) Deprecated.Create a datasource from a byte array.ByteArrayDataSource
(InputStream aIs, String aType) Deprecated.Create a datasource from an input stream.ByteArrayDataSource
(String data, String aType) Deprecated.Create a datasource from a String. -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.Get the content type.Deprecated.Get the input stream.getName()
Deprecated.Get the name.Deprecated.Get the OutputStream to write to.void
Deprecated.Sets the name for this DataSource.
-
Field Details
-
BUFFER_SIZE
public static final int BUFFER_SIZEDeprecated.Define the buffer size.- See Also:
-
-
Constructor Details
-
ByteArrayDataSource
Deprecated.Create a datasource from a byte array.- Parameters:
data
- A byte[].aType
- A String.- Throws:
IOException
- IOException- Since:
- 1.0
-
ByteArrayDataSource
Deprecated.Create a datasource from an input stream.- Parameters:
aIs
- An InputStream.aType
- A String.- Throws:
IOException
- IOException- Since:
- 1.0
-
ByteArrayDataSource
Deprecated.Create a datasource from a String. N.B. assumes the data string can be converted using the charset iso-8859-1.- Parameters:
data
- A String.aType
- A String.- Throws:
IOException
- IOException- Since:
- 1.0
-
-
Method Details
-
getContentType
Deprecated.Get the content type.- Specified by:
getContentType
in interfacejavax.activation.DataSource
- Returns:
- A String.
- Since:
- 1.0
-
getInputStream
Deprecated.Get the input stream.- Specified by:
getInputStream
in interfacejavax.activation.DataSource
- Returns:
- An InputStream.
- Throws:
IOException
- IOException- Since:
- 1.0
-
setName
Deprecated.Sets the name for this DataSource.- Parameters:
name
- The name.- Since:
- 1.3.1
-
getName
Deprecated.Get the name.- Specified by:
getName
in interfacejavax.activation.DataSource
- Returns:
- A String.
- Since:
- 1.0
-
getOutputStream
Deprecated.Get the OutputStream to write to.- Specified by:
getOutputStream
in interfacejavax.activation.DataSource
- Returns:
- An OutputStream
- Since:
- 1.0
-
ByteArrayDataSource
instead