com.infoengine.webject.msg
Class ByteArrayDataSource

java.lang.Object
  extended bycom.infoengine.webject.msg.ByteArrayDataSource
All Implemented Interfaces:
javax.activation.DataSource

class ByteArrayDataSource
extends Object
implements javax.activation.DataSource

This class implements a typed DataSource from: an InputStream a byte array a String


Field Summary
private  String contentType
           
private  byte[] data
           
private static Hashtable encodings
           
private  String name
           
 
Constructor Summary
(package private) ByteArrayDataSource(byte[] data, String contentType)
           
(package private) ByteArrayDataSource(InputStream is, String contentType)
           
(package private) ByteArrayDataSource(String data, String contentType)
           
 
Method Summary
 String getContentType()
           
private  String getEncoding(String contentType)
          Produces a character encoding name from a MIME content type header value.
 InputStream getInputStream()
           
 String getName()
           
 OutputStream getOutputStream()
           
 void setName(String name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

contentType

private String contentType

data

private byte[] data

name

private String name

encodings

private static Hashtable encodings
Constructor Detail

ByteArrayDataSource

ByteArrayDataSource(InputStream is,
                    String contentType)
              throws IOException

ByteArrayDataSource

ByteArrayDataSource(byte[] data,
                    String contentType)

ByteArrayDataSource

ByteArrayDataSource(String data,
                    String contentType)
              throws UnsupportedEncodingException
Method Detail

getInputStream

public InputStream getInputStream()
                           throws IOException
Specified by:
getInputStream in interface javax.activation.DataSource
Throws:
IOException

getOutputStream

public OutputStream getOutputStream()
                             throws IOException
Specified by:
getOutputStream in interface javax.activation.DataSource
Throws:
IOException

getContentType

public String getContentType()
Specified by:
getContentType in interface javax.activation.DataSource

getName

public String getName()
Specified by:
getName in interface javax.activation.DataSource

setName

public void setName(String name)

getEncoding

private String getEncoding(String contentType)
Produces a character encoding name from a MIME content type header value.

Parameters:
contentType - The MIME content type
Returns:
The character encoding name, or null if no encoding name indicated.