Class FileItemIteratorImpl
- java.lang.Object
- 
- org.apache.tomcat.util.http.fileupload.impl.FileItemIteratorImpl
 
- 
- All Implemented Interfaces:
- FileItemIterator
 
 public class FileItemIteratorImpl extends java.lang.Object implements FileItemIterator The iterator, which is returned byFileUploadBase.getItemIterator(RequestContext).
- 
- 
Constructor SummaryConstructors Constructor Description FileItemIteratorImpl(FileUploadBase fileUploadBase, RequestContext requestContext)Creates a new instance.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<FileItem>getFileItems()longgetFileSizeMax()Returns the maximum size of a single file.MultipartStreamgetMultiPartStream()longgetSizeMax()Returns the maximum size of the complete HTTP request.booleanhasNext()Returns, whether another instance ofFileItemStreamis available.protected voidinit(FileUploadBase fileUploadBase, RequestContext pRequestContext)FileItemStreamnext()Returns the next availableFileItemStream.voidsetFileSizeMax(long fileSizeMax)Sets the maximum size of a single file.voidsetSizeMax(long sizeMax)Returns the maximum size of the complete HTTP request.
 
- 
- 
- 
Constructor Detail- 
FileItemIteratorImplpublic FileItemIteratorImpl(FileUploadBase fileUploadBase, RequestContext requestContext) throws FileUploadException, java.io.IOException Creates a new instance.- Parameters:
- fileUploadBase- Main processor.
- requestContext- The request context.
- Throws:
- FileUploadException- An error occurred while parsing the request.
- java.io.IOException- An I/O error occurred.
 
 
- 
 - 
Method Detail- 
getSizeMaxpublic long getSizeMax() Description copied from interface:FileItemIteratorReturns the maximum size of the complete HTTP request. ASizeLimitExceededExceptionwill be thrown, if the HTTP request will exceed this value. By default, this value will be copied from theFileUploadBaseobject, however, the user may replace the default value with a request specific value by invokingFileItemIterator.setSizeMax(long)on this object.- Specified by:
- getSizeMaxin interface- FileItemIterator
- Returns:
- The maximum size of the complete HTTP request. The value -1 indicates "unlimited".
 
 - 
setSizeMaxpublic void setSizeMax(long sizeMax) Description copied from interface:FileItemIteratorReturns the maximum size of the complete HTTP request. ASizeLimitExceededExceptionwill be thrown, if the HTTP request will exceed this value. By default, this value will be copied from theFileUploadBaseobject, however, the user may replace the default value with a request specific value by invokingFileItemIterator.setSizeMax(long)on this object. Note: Setting the maximum size on this object will work only, if the iterator is not yet initialized. In other words: If the methodsFileItemIterator.hasNext(),FileItemIterator.next()have not yet been invoked.- Specified by:
- setSizeMaxin interface- FileItemIterator
- Parameters:
- sizeMax- The maximum size of the complete HTTP request. The value -1 indicates "unlimited".
 
 - 
getFileSizeMaxpublic long getFileSizeMax() Description copied from interface:FileItemIteratorReturns the maximum size of a single file. AnFileSizeLimitExceededExceptionwill be thrown, if there is an uploaded file, which is exceeding this value. By default, this value will be copied from theFileUploadBaseobject, however, the user may replace the default value with a request specific value by invokingFileItemIterator.setFileSizeMax(long)on this object.- Specified by:
- getFileSizeMaxin interface- FileItemIterator
- Returns:
- The maximum size of a single, uploaded file. The value -1 indicates "unlimited".
 
 - 
setFileSizeMaxpublic void setFileSizeMax(long fileSizeMax) Description copied from interface:FileItemIteratorSets the maximum size of a single file. AnFileSizeLimitExceededExceptionwill be thrown, if there is an uploaded file, which is exceeding this value. By default, this value will be copied from theFileUploadBaseobject, however, the user may replace the default value with a request specific value by invokingFileItemIterator.setFileSizeMax(long)on this object, so there is no need to configure it here. Note:Changing this value doesn't affect files, that have already been uploaded.- Specified by:
- setFileSizeMaxin interface- FileItemIterator
- Parameters:
- fileSizeMax- The maximum size of a single, uploaded file. The value -1 indicates "unlimited".
 
 - 
initprotected void init(FileUploadBase fileUploadBase, RequestContext pRequestContext) throws FileUploadException, java.io.IOException - Throws:
- FileUploadException
- java.io.IOException
 
 - 
getMultiPartStreampublic MultipartStream getMultiPartStream() throws FileUploadException, java.io.IOException - Throws:
- FileUploadException
- java.io.IOException
 
 - 
hasNextpublic boolean hasNext() throws FileUploadException, java.io.IOExceptionReturns, whether another instance ofFileItemStreamis available.- Specified by:
- hasNextin 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.
 
 - 
nextpublic FileItemStream next() throws FileUploadException, java.io.IOException Returns the next availableFileItemStream.- Specified by:
- nextin 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.
 
 - 
getFileItemspublic java.util.List<FileItem> getFileItems() throws FileUploadException, java.io.IOException - Specified by:
- getFileItemsin interface- FileItemIterator
- Throws:
- FileUploadException
- java.io.IOException
 
 
- 
 
-