Package org.apache.commons.mail
Class ByteArrayDataSource
- java.lang.Object
-
- org.apache.commons.mail.ByteArrayDataSource
-
- All Implemented Interfaces:
javax.activation.DataSource
@Deprecated public class ByteArrayDataSource extends java.lang.Object implements javax.activation.DataSource
Deprecated.since 1.4, useByteArrayDataSourceorSharedByteArrayInputStream.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
Fields Modifier and Type Field Description static intBUFFER_SIZEDeprecated.Define the buffer size.
-
Constructor Summary
Constructors Constructor Description ByteArrayDataSource(byte[] data, java.lang.String contentType)Deprecated.Constructs a new instance from a byte array.ByteArrayDataSource(java.io.InputStream inputStream, java.lang.String contentType)Deprecated.Constructs a new instance from an input stream.ByteArrayDataSource(java.lang.String data, java.lang.String contentType)Deprecated.Constructs a new instance from a String.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.StringgetContentType()Deprecated.Gets the content contentType.java.io.InputStreamgetInputStream()Deprecated.Gets the input stream.java.lang.StringgetName()Deprecated.Gets the name.java.io.OutputStreamgetOutputStream()Deprecated.Gets the OutputStream to write to.voidsetName(java.lang.String name)Deprecated.Sets the name for this DataSource.
-
-
-
Field Detail
-
BUFFER_SIZE
public static final int BUFFER_SIZE
Deprecated.Define the buffer size.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ByteArrayDataSource
public ByteArrayDataSource(byte[] data, java.lang.String contentType) throws java.io.IOException
Deprecated.Constructs a new instance from a byte array.- Parameters:
data- A byte[].contentType- A String.- Throws:
java.io.IOException- IOException- Since:
- 1.0
-
ByteArrayDataSource
public ByteArrayDataSource(java.io.InputStream inputStream, java.lang.String contentType) throws java.io.IOException
Deprecated.Constructs a new instance from an input stream.- Parameters:
inputStream- An InputStream.contentType- A String.- Throws:
java.io.IOException- IOException- Since:
- 1.0
-
ByteArrayDataSource
public ByteArrayDataSource(java.lang.String data, java.lang.String contentType) throws java.io.IOException
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:
java.io.IOException- IOException- Since:
- 1.0
-
-
Method Detail
-
getContentType
public java.lang.String getContentType()
Deprecated.Gets the content contentType.- Specified by:
getContentTypein interfacejavax.activation.DataSource- Returns:
- A String.
- Since:
- 1.0
-
getInputStream
public java.io.InputStream getInputStream() throws java.io.IOException
Deprecated.Gets the input stream.- Specified by:
getInputStreamin interfacejavax.activation.DataSource- Returns:
- An InputStream.
- Throws:
java.io.IOException- IOException- Since:
- 1.0
-
getName
public java.lang.String getName()
Deprecated.Gets the name.- Specified by:
getNamein interfacejavax.activation.DataSource- Returns:
- A String.
- Since:
- 1.0
-
getOutputStream
public java.io.OutputStream getOutputStream()
Deprecated.Gets the OutputStream to write to.- Specified by:
getOutputStreamin interfacejavax.activation.DataSource- Returns:
- An OutputStream
- Since:
- 1.0
-
setName
public void setName(java.lang.String name)
Deprecated.Sets the name for this DataSource.- Parameters:
name- The name.- Since:
- 1.3.1
-
-