org.apache.commons.fileupload
Class FileUploadBase.FileItemIteratorImpl

java.lang.Object
  extended by org.apache.commons.fileupload.FileUploadBase.FileItemIteratorImpl
All Implemented Interfaces:
FileItemIterator
Enclosing class:
FileUploadBase

private class FileUploadBase.FileItemIteratorImpl
extends java.lang.Object
implements FileItemIterator

The iterator, which is returned by FileUploadBase.getItemIterator(RequestContext).


Nested Class Summary
private  class FileUploadBase.FileItemIteratorImpl.FileItemStreamImpl
          Default implementation of FileItemStream.
 
Field Summary
private  byte[] boundary
          The boundary, which separates the various parts.
private  java.lang.String currentFieldName
          The current items field name.
private  FileUploadBase.FileItemIteratorImpl.FileItemStreamImpl currentItem
          The item, which we currently process.
private  boolean eof
          Whether we have seen the end of the file.
private  boolean itemValid
          Whether the current item may still be read.
private  MultipartStream multi
          The multi part stream to process.
private  MultipartStream.ProgressNotifier notifier
          The notifier, which used for triggering the ProgressListener.
private  boolean skipPreamble
          Whether we are currently skipping the preamble.
 
Constructor Summary
FileUploadBase.FileItemIteratorImpl(RequestContext ctx)
          Creates a new instance.
 
Method Summary
private  boolean findNextItem()
          Called for finding the nex item, if any.
private  long getContentLength(FileItemHeaders pHeaders)
           
 boolean hasNext()
          Returns, whether another instance of FileItemStream is available.
 FileItemStream next()
          Returns the next available FileItemStream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

multi

private final MultipartStream multi
The multi part stream to process.


notifier

private final MultipartStream.ProgressNotifier notifier
The notifier, which used for triggering the ProgressListener.


boundary

private final byte[] boundary
The boundary, which separates the various parts.


currentItem

private FileUploadBase.FileItemIteratorImpl.FileItemStreamImpl currentItem
The item, which we currently process.


currentFieldName

private java.lang.String currentFieldName
The current items field name.


skipPreamble

private boolean skipPreamble
Whether we are currently skipping the preamble.


itemValid

private boolean itemValid
Whether the current item may still be read.


eof

private boolean eof
Whether we have seen the end of the file.

Constructor Detail

FileUploadBase.FileItemIteratorImpl

FileUploadBase.FileItemIteratorImpl(RequestContext ctx)
                              throws FileUploadException,
                                     java.io.IOException
Creates a new instance.

Parameters:
ctx - The request context.
Throws:
FileUploadException - An error occurred while parsing the request.
java.io.IOException - An I/O error occurred.
Method Detail

findNextItem

private boolean findNextItem()
                      throws java.io.IOException
Called for finding the nex item, if any.

Returns:
True, if an next item was found, otherwise false.
Throws:
java.io.IOException - An I/O error occurred.

getContentLength

private long getContentLength(FileItemHeaders pHeaders)

hasNext

public boolean hasNext()
                throws FileUploadException,
                       java.io.IOException
Returns, whether another instance of FileItemStream is available.

Specified by:
hasNext in interface FileItemIterator
Returns:
True, if one or more additional file items are available, otherwise false.
Throws:
FileUploadException - Parsing or processing the file item failed.
java.io.IOException - Reading the file item failed.

next

public FileItemStream next()
                    throws FileUploadException,
                           java.io.IOException
Returns the next available FileItemStream.

Specified by:
next in interface FileItemIterator
Returns:
FileItemStream instance, which provides access to the next file item.
Throws:
java.util.NoSuchElementException - No more items are available. Use hasNext() to prevent this exception.
FileUploadException - Parsing or processing the file item failed.
java.io.IOException - Reading the file item failed.