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) class
FileUploadBase.FileItemIteratorImpl.FileItemStreamImpl
Default implementation ofFileItemStream
.
-
Field Summary
Fields Modifier and Type Field Description 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 theProgressListener
.private boolean
skipPreamble
Whether 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 boolean
findNextItem()
Called for finding the next item, if any.private long
getContentLength(FileItemHeaders pHeaders)
boolean
hasNext()
Returns, whether another instance ofFileItemStream
is available.FileItemStream
next()
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.IOException
Called 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.IOException
Returns, whether another instance ofFileItemStream
is available.- Specified by:
hasNext
in 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:
next
in 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.
-
-