com.bea.wli.sb.sources
Class MimeSource

java.lang.Object
  extended by com.bea.wli.sb.sources.MimeSource
All Implemented Interfaces:
Source

public class MimeSource
extends Object
implements Source

Source representing arbitrary content with headers. Essentially this is a Source that represents a MIME part. Headers must conform to RFC822 whereas the Source can be any type of source. The serialization format for this Source is a fully-compliant MIME package. This source is also cognizant of Content-Transfer-Encoding, and it will perform the proper encoding of the underlying content stream if the header is present. Note that this means that the Source provided to the constructor should be in raw form and should not be already encoded.


Field Summary
 
Fields inherited from interface com.bea.wli.sb.sources.Source
DEFAULT_CHARACTER_SET_ENCODING
 
Constructor Summary
MimeSource(Headers headers, Source content)
           
 
Method Summary
 Source getContent()
           
 Headers getHeaders()
           
 InputStream getInputStream(TransformOptions options)
          Returns streaming byte-baseed representation of the Source's content.
 void writeTo(OutputStream out, TransformOptions options)
          Serializes the Source's content to a byte-based stream.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MimeSource

public MimeSource(Headers headers,
                  Source content)
Method Detail

getHeaders

public Headers getHeaders()

getContent

public Source getContent()

getInputStream

public InputStream getInputStream(TransformOptions options)
                           throws IOException,
                                  TransformException
Description copied from interface: Source
Returns streaming byte-baseed representation of the Source's content. The representation of that serialization is entirely up to the Source. Note that this method may involve an internal transformation, although it should not in any way change the underlying content.

Specified by:
getInputStream in interface Source
Parameters:
options - Options used to affect the serialization
Returns:
an InputStream for retrieving the serialized content
Throws:
IOException
TransformException

writeTo

public void writeTo(OutputStream out,
                    TransformOptions options)
             throws IOException,
                    TransformException
Description copied from interface: Source
Serializes the Source's content to a byte-based stream. The representation of that serialization is entirely up to the Source. The Source is forbidden from closing the provided OutputStream, although it is allowed to flush it. However, flushing the stream should be left to the caller, if possible.

Note that this method may involve an internal transformation, although it should not in any way change the underlying content.

Specified by:
writeTo in interface Source
Parameters:
out - the OutputStream to which serialized content will be written
options - TransformOptions used to affect the serialization
Throws:
IOException
TransformException