com.ibm.portal.resolver.streams
Class MultipartOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by com.ibm.portal.resolver.streams.MultipartOutputStream
All Implemented Interfaces:
MultipartStream, java.io.Closeable, java.io.Flushable, java.nio.channels.Channel

public abstract class MultipartOutputStream
extends java.io.OutputStream
implements MultipartStream

Implementation of a stream that can be used to produce multipart streams. Implementations of this stream can be retrieved via the StreamFactory . The usage of this class is similar to ZipOutputStream. In order to produce a multipart output

Since:
6.1.0

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.ibm.portal.resolver.streams.MultipartStream
MultipartStream.Entry
 
Field Summary
 
Fields inherited from interface com.ibm.portal.resolver.streams.MultipartStream
CONTENT_TYPE_FORM_DATA, CONTENT_TYPE_MULTIPART, KEY_CONTENT_DISPOSITION, KEY_FILENAME, KEY_MIME_BOUNDARY, KEY_NAME, VALUE_FORM_DATA, VALUE_MULTIPART
 
Constructor Summary
MultipartOutputStream()
           
 
Method Summary
abstract  void finish()
          Finishes writing the contents of the multipart output stream without closing the underlying stream.
abstract  java.io.OutputStream putNextEntry(MultipartStream.Entry entry)
          Begins writing a new multipart file entry and positions the stream to the start of the entry data.
abstract  void writeEntry(MultipartInputStream.Entry entry)
          Writes (copies) a complete multipart entry from an input stream.
 
Methods inherited from class java.io.OutputStream
close, flush, write, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ibm.portal.resolver.streams.MultipartStream
closeEntry
 
Methods inherited from interface java.nio.channels.Channel
close, isOpen
 

Constructor Detail

MultipartOutputStream

public MultipartOutputStream()
Method Detail

finish

public abstract void finish()
                     throws java.io.IOException
Finishes writing the contents of the multipart output stream without closing the underlying stream. Use this method when applying multiple filters in succession to the same output stream. Calling finish on a stream that is already closed or finished will be a noop.

Throws:
java.io.IOException - - if an I/O error has occurred

putNextEntry

public abstract java.io.OutputStream putNextEntry(MultipartStream.Entry entry)
                                           throws java.io.IOException
Begins writing a new multipart file entry and positions the stream to the start of the entry data. Closes the current entry if still active.

Parameters:
entry - the multipart entry to be written. This parameter may be null, in this case no headers are written and the defaults apply
Returns:
an OutputStream that represents the content of the entry. Callers may call OutputStream.close() to indicate that the current entry is closed.
Throws:
java.io.IOException - - if an I/O error has occurred

writeEntry

public abstract void writeEntry(MultipartInputStream.Entry entry)
                         throws java.io.IOException
Writes (copies) a complete multipart entry from an input stream. The method will first call putNextEntry(com.ibm.portal.resolver.streams.MultipartStream.Entry) and then copy the content of the source entry to the output stream.

Parameters:
entry - the entry to copy. This parameter may be null, in this case no headers nor content are written and the defaults apply.
Throws:
java.io.IOException
Since:
7.0.0.1