com.atlassian.jira.mail.util
Class ByteArrayDataSource

java.lang.Object
  extended by com.atlassian.jira.mail.util.ByteArrayDataSource
All Implemented Interfaces:
javax.activation.DataSource

public class ByteArrayDataSource
extends java.lang.Object
implements javax.activation.DataSource

This is a DataSource that reads input from a stream and captures it into a ByteArray. This is useful for capturing strea data into emails for example.

Since:
v3.13.3

Constructor Summary
ByteArrayDataSource(java.io.InputStream inputStream, java.lang.String contentType)
          Create a datasource from an input stream.
 
Method Summary
 java.lang.String getContentType()
          Get the content type.
 java.io.InputStream getInputStream()
          Get the input stream.
 java.lang.String getName()
          Get the name.
 java.io.OutputStream getOutputStream()
          Get the OutputStream to write to
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteArrayDataSource

public ByteArrayDataSource(java.io.InputStream inputStream,
                           java.lang.String contentType)
                    throws java.io.IOException
Create a datasource from an input stream.

Parameters:
inputStream - This is NOT closed as a result of this operation
contentType - The content type of the data
Throws:
java.io.IOException
Method Detail

getContentType

public java.lang.String getContentType()
Get the content type.

Specified by:
getContentType in interface javax.activation.DataSource
Returns:
A String.

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Get the input stream.

Specified by:
getInputStream in interface javax.activation.DataSource
Returns:
An InputStream.
Throws:
java.io.IOException

getName

public java.lang.String getName()
Get the name.

Specified by:
getName in interface javax.activation.DataSource
Returns:
A String.

getOutputStream

public java.io.OutputStream getOutputStream()
                                     throws java.io.IOException
Get the OutputStream to write to

Specified by:
getOutputStream in interface javax.activation.DataSource
Returns:
An OutputStream
Throws:
java.io.IOException


Copyright © 2002-2010 Atlassian. All Rights Reserved.