Package org.apache.commons.fileupload
Class FileUploadBase.FileItemIteratorImpl
java.lang.Object
org.apache.commons.fileupload.FileUploadBase.FileItemIteratorImpl
- All Implemented Interfaces:
FileItemIterator
- Enclosing class:
FileUploadBase
The iterator, which is returned by
FileUploadBase.getItemIterator(RequestContext).-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final byte[]The boundary, which separates the various parts.private StringThe current items field name.The item, which we currently process.private booleanWhether we have seen the end of the file.private booleanWhether the current item may still be read.private final MultipartStreamThe multi part stream to process.private final booleanIs this a multipart/related Request.private final MultipartStream.ProgressNotifierThe notifier, which used for triggering theProgressListener.private booleanWhether we are currently skipping the preamble. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate booleanCalled for finding the next item, if any.private longgetContentLength(FileItemHeaders headers) booleanhasNext()Returns, whether another instance ofFileItemStreamis available.next()Returns the next availableFileItemStream.
-
Field Details
-
multi
The multi part stream to process. -
notifier
The notifier, which used for triggering theProgressListener. -
boundary
private final byte[] boundaryThe boundary, which separates the various parts. -
currentItem
The item, which we currently process. -
currentFieldName
The current items field name. -
skipPreamble
private boolean skipPreambleWhether we are currently skipping the preamble. -
itemValid
private boolean itemValidWhether the current item may still be read. -
eof
private boolean eofWhether we have seen the end of the file. -
multipartRelated
private final boolean multipartRelatedIs this a multipart/related Request.
-
-
Constructor Details
-
FileItemIteratorImpl
FileItemIteratorImpl(RequestContext ctx) throws FileUploadException, IOException Creates a new instance.- Parameters:
ctx- The request context.- Throws:
FileUploadException- An error occurred while parsing the request.IOException- An I/O error occurred.
-
-
Method Details
-
findNextItem
Called for finding the next item, if any.- Returns:
- True, if an next item was found, otherwise false.
- Throws:
IOException- An I/O error occurred.
-
getContentLength
-
hasNext
Returns, 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.IOException- Reading the file item failed.
-
next
Returns the next availableFileItemStream.- Specified by:
nextin interfaceFileItemIterator- Returns:
- FileItemStream instance, which provides access to the next file item.
- Throws:
NoSuchElementException- No more items are available. UsehasNext()to prevent this exception.FileUploadException- Parsing or processing the file item failed.IOException- Reading the file item failed.
-