Package org.apache.commons.fileupload
Class FileUploadBase.FileItemIteratorImpl
- java.lang.Object
-
- 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 byFileUploadBase.getItemIterator(RequestContext).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classFileUploadBase.FileItemIteratorImpl.FileItemStreamImplDefault implementation ofFileItemStream.
-
Field Summary
Fields Modifier and Type Field Description private byte[]boundaryThe boundary, which separates the various parts.private java.lang.StringcurrentFieldNameThe current items field name.private FileUploadBase.FileItemIteratorImpl.FileItemStreamImplcurrentItemThe item, which we currently process.private booleaneofWhether we have seen the end of the file.private booleanitemValidWhether the current item may still be read.private MultipartStreammultiThe multi part stream to process.private MultipartStream.ProgressNotifiernotifierThe notifier, which used for triggering theProgressListener.private booleanskipPreambleWhether we are currently skipping the preamble.
-
Constructor Summary
Constructors Constructor Description FileItemIteratorImpl(RequestContext ctx)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private booleanfindNextItem()Called for finding the next item, if any.private longgetContentLength(FileItemHeaders pHeaders)booleanhasNext()Returns, whether another instance ofFileItemStreamis available.FileItemStreamnext()Returns the next availableFileItemStream.
-
-
-
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 theProgressListener.
-
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
-
FileItemIteratorImpl
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.IOExceptionCalled for finding the next 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.IOExceptionReturns, whether another instance ofFileItemStreamis available.- Specified by:
hasNextin interfaceFileItemIterator- 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 availableFileItemStream.- Specified by:
nextin interfaceFileItemIterator- Returns:
- FileItemStream instance, which provides access to the next file item.
- Throws:
java.util.NoSuchElementException- No more items are available. UsehasNext()to prevent this exception.FileUploadException- Parsing or processing the file item failed.java.io.IOException- Reading the file item failed.
-
-