org.webdocwf.util.smime.activation
Class StreamDataSource

java.lang.Object
  |
  +--org.webdocwf.util.smime.activation.StreamDataSource
All Implemented Interfaces:
javax.activation.DataSource

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

StreamDataSource represents implementation of DataSource interfaces, and as result of that, objects of this class could be used within MimeBodyPart objects to help them to read data from objects which they conveys. This class is designed to help in getting data from objects of type InputStream and all its subclasses.


Constructor Summary
StreamDataSource(java.io.InputStream in0, java.lang.String fileName0)
          Constructs StreamDataSource with given input stream and coresponding string which contains virtual or real file name.
 
Method Summary
 java.lang.String getContentType()
          Implements getContentType method from DataSource interface
 java.io.InputStream getInputStream()
          Implements getInputStream method from DataSource interface
 java.lang.String getName()
          Implements getName method from DataSource interface
 java.io.OutputStream getOutputStream()
          Implements getOutputStream method from DataSource interface.
 void setContentType(java.lang.String contType0)
          Sets content type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StreamDataSource

public StreamDataSource(java.io.InputStream in0,
                        java.lang.String fileName0)
                 throws SMIMEException
Constructs StreamDataSource with given input stream and coresponding string which contains virtual or real file name. Extension of file name is used to get appropriate mime-type. All mime-types which are predefined according to particular file extensions can be found in mime.types file in META-INF directory from smime.jar file. This file can be changed or extended so that it could adjust mime-types to aditional requests. For more information see Java documentation related to class MimetypesFileTypeMap.
Method Detail

setContentType

public void setContentType(java.lang.String contType0)
Sets content type. Using of this metod should be avoided because Content-Type is set in the process of construction of StreamDataSource object, by using information got from "fileName0" parameter. This method will override value set after construction. This method will be used when construction is performed with null value of "fileName0" parameter, or in case when automatic obtaining of value for content-type did not satisfy what is expected.
Parameters:
contType0 - Content-Type

getContentType

public java.lang.String getContentType()
Implements getContentType method from DataSource interface
Specified by:
getContentType in interface javax.activation.DataSource
Returns:
Content-Type for MIME message header field

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Implements getInputStream method from DataSource interface
Specified by:
getInputStream in interface javax.activation.DataSource
Returns:
CMS enveloped object
Throws:
java.io.IOException -  

getName

public java.lang.String getName()
Implements getName method from DataSource interface
Specified by:
getName in interface javax.activation.DataSource
Returns:
Name: EnvelopedDataContentInfo

getOutputStream

public java.io.OutputStream getOutputStream()
                                     throws java.io.IOException
Implements getOutputStream method from DataSource interface. This method is not in use.
Specified by:
getOutputStream in interface javax.activation.DataSource
Returns:
nothing
Throws:
java.io.IOException - is always thrown when this method is used.


Copyright © 2002-2002 Together Teamlösungen. All Rights Reserved.