com.ibm.portal.resolver.streams
Class MultipartInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by com.ibm.portal.resolver.streams.MultipartInputStream
All Implemented Interfaces:
MultipartStream, java.io.Closeable

public abstract class MultipartInputStream
extends java.io.InputStream
implements MultipartStream

Input stream that represents the content of a multipart stream following RFC 1521. This multipart stream consists of zero or more substreams that are each separated via a boundary. The construction logic of the instance of MultipartInputStream needs to take care that the correct boundary value is specified. This boundary is typically defered from the content-type request header.

The caller can step over the multipart entries using the getNextEntry() method. Calling this method returns a description of the next entry or null if no entry is available. In addition the input stream will be reset to represent the content of the entry. This content will already be decoded wtr to the Content-Transfer-Encoding header of the entry. Reading the complete input stream until any of the read-method returns -1 will read up to the end of the current entry.

The design of this abstract class has been modelled after ZipInputStream.

Instances of MultipartInputStream can be created via the com.ibm.portal.resolver.streams.StreamFactory.

Since:
6.0.1

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, KEY_CONTENT_DISPOSITION, KEY_FILENAME, KEY_MIME_BOUNDARY, KEY_NAME, VALUE_FORM_DATA
 
Constructor Summary
MultipartInputStream()
           
 
Method Summary
abstract  MultipartStream.Entry getNextEntry()
           Reads the next multipart stream entry and positions stream at the beginning of the entry data.
 
Methods inherited from class java.io.InputStream
available, close, mark, markSupported, read, read, read, reset, skip
 
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
 

Constructor Detail

MultipartInputStream

public MultipartInputStream()
Method Detail

getNextEntry

public abstract MultipartStream.Entry getNextEntry()
                                            throws java.io.IOException

Reads the next multipart stream entry and positions stream at the beginning of the entry data. Note that Entry instances may be recycled, the entry is only valid until the next call to getNextEntry() or MultipartStream.closeEntry().

The implementation will at least interpret the following headers automatically

Returns:
the multipart entry just read or null if there is no more entry
Throws:
java.io.IOException - if an I/O error has occurred